Skip to content

When returned other types, the generated code is incorrect #336

@GGXXLL

Description

@GGXXLL

such as google.protobuf.StringValue

proto file:

syntax = "proto3";

package pb;

import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "google/protobuf/wrappers.proto";

service Hello {
  rpc Helloworld (HelloworldRequest) returns (google.protobuf.StringValue) {
    option (google.api.http) = {
      get: "/hello/"
    };
  }
}

message HelloworldRequest {
  string name = 1;
}

the generated code:

func (s helloService) Helloworld(ctx context.Context, in *pb.HelloworldRequest) (*pb.StringValue, error) {
	var resp pb.StringValue
	return &resp, nil
}

It should be

import types "github.com/gogo/protobuf/types"

...

type HelloServer interface {
	Helloworld(context.Context, *HelloworldRequest) (*types.StringValue, error)
}

Metadata

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