title: Error in generated code with protoc-gen-grpc-gateway
body: <p>I'm new to Protocol Buffers and gRPC stuff. Now I'm trying to build a client/server architecture with grpc + grpc-gateway in Go.</p>
  <p>I tried to follow some examples but I always end up with the same problem.
  After generating the code with <code>protoc</code> i run <code>go build</code> and I get this error:</p>
  <pre><code>proto/helloworld/hello_world.pb.gw.go:64:2: cannot use msg (type *HelloReply) as type protoreflect.ProtoMessage in return argument:
          *HelloReply does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
  proto/helloworld/hello_world.pb.gw.go:98:2: cannot use msg (type *HelloReply) as type protoreflect.ProtoMessage in return argument:
          *HelloReply does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
  </code></pre>
  <p>This is <code>go.mod</code>:</p>
  <pre><code>module github.com/riccardopedrielli/grpc-gateway-test
  
  go 1.15
  
  require (
      github.com/golang/protobuf v1.4.3
      github.com/grpc-ecosystem/grpc-gateway/v2 v2.2.0
      google.golang.org/genproto v0.0.0-20210207032614-bba0dbe2a9ea
      google.golang.org/grpc v1.35.0
      google.golang.org/protobuf v1.25.0
  )
  </code></pre>
  <p>This is <code>hello_world.proto</code>:</p>
  <pre class="lang-proto prettyprint-override"><code>syntax = &quot;proto3&quot;;
  
  package helloworld;
  
  import &quot;google/api/annotations.proto&quot;;
  
  option go_package = &quot;github.com/riccardopedrielli/grpc-gateway-test/proto/helloworld&quot;;
  
  // Here is the overall greeting service definition where we define all our endpoints
  service Greeter {
    // Sends a greeting
    rpc SayHello (HelloRequest) returns (HelloReply) {
      option (google.api.http) = {
        get: &quot;/v1/example/echo/{name}&quot;
      };
    }
  }
  
  // The request message containing the user's name
  message HelloRequest {
    string name = 1;
  }
  
  // The response message containing the greetings
  message HelloReply {
    string message = 1;
  }
  </code></pre>
  <p>This is the link to the repository: <a href="https://github.com/riccardopedrielli/grpc-gateway-test" rel="nofollow noreferrer">https://github.com/riccardopedrielli/grpc-gateway-test</a></p>
  <p>A difference I see between the generated go files is that they are importing different protobuf libraries.<br />
  The one generated by <code>protoc-gen-go</code> imports <code>github.com/golang/protobuf/proto</code>.<br />
  The one generated by <code>protoc-gen-grpc-gateway</code> imports <code>google.golang.org/protobuf/proto</code>.<br />
  Could this be the cause of the problem?</p>
  <p>Still it's not clear to me which one should be used and how to force the same in both the generators.</p>
  <p>I'm new to grpc and quite lost at this point, so I could have omitted some important informations. Any suggestion will be welcomed.</p>
  <p>Thank you</p>