Skip to content

Run demo failed! #1777

Closed
Closed
@AP0rPi7uQ9

Description

Directory Structure:

test
|--test.proto
|--google (This directory is copied from /github.com/grpc-ecosystem/grpc-gateway/v2@v2.0.1/third_party/googleapis/google)
|--gen
|----go

test.proto

 syntax = "proto3";
 package your.service.v1;
 option go_package = "github.com/yourorg/yourprotos/gen/go/your/service/v1";
 import "google/api/annotations.proto";
 message StringMessage {
   string value = 1;
 }

 service YourService {
   rpc Echo(StringMessage) returns (StringMessage) {
    option (google.api.http) = {
        post: "/v1/example/echo"
        body: "*"
    };
   }
 }

When I run 【protoc -I . --grpc-gateway_out ./gen/go --grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=sourc
e_relative test.proto】, it is the same as the command in demo.

I failed and got an error message

> C:\Users\User\go\src\grpc\test>protoc -I . --grpc-gateway_out ./gen/go --grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=sourc
e_relative test.proto
google/protobuf/descriptor.proto: File not found.
google/api/annotations.proto:20:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
google/api/annotations.proto:28:8: "google.protobuf.MethodOptions" is not defined.
test.proto:4:2: Import "google/api/annotations.proto" was not found or had errors.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions