protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Use protoc-gen-gofast when go module is on

Open mars315 opened this issue 4 years ago • 2 comments

in my project , go module is on, the project directory is as follow:

pro-├── go.mod
        ├── pb
        │        ├── user
        │        │      ├── user.proto
        │        ├── city.proto

go.mod: module git.a.com/p1/game

user.proto:

package user; 
message User{ 
	int32 id = 1; 
	string name =2; 
} 

city.proto:

package city;
import "pb/user/user.proto";

message city {
	User u = 1;
}

city.pb.go

package city
import (
    ...
    user "pb/user"
    ...
)

what can i do to change the package importing from user "pb/user" to user "git.a.com/p1/game/pb/user" ? thx.

mars315 avatar Mar 12 '20 09:03 mars315

Is there any play for tools to fully support go module? thx.

mars315 avatar Mar 13 '20 01:03 mars315

just stumbled onto this, if you add this in your proto file it will work

option go_package = "git.a.com/p1/game/pb/user";

aselus-hub avatar Apr 06 '20 19:04 aselus-hub