提问者:小点点

github.com/golang/protobuf/protoc-gen-go没有Go语言版本1.18的包路径


我们正在尝试构建一个应用程序,但无法使用protoc gen go生成代码

$使

go版本go1.18 linux/amd64

/usr/本地/go/bin/go

make-C go\u源所有

make[1]:输入目录“/home/593m/team\u name/zk/internal pkg/go\u source”cd/home/593m/team\u name/zk/internal pkg/go\u source//src/nexus。com/vendor/github。com/golang/protobuf/protoc gen go;go install without-mod=vendor,directory/home/593m/team\u name/zk/internal pkg/go\u source/src/appnexus。com/vendor/github。com/golang/protobuf/protoc gen go没有包路径生成文件:72:目标配方“/home/593m/team\u name/zk/internal pkg/go\u source/bin/protoc gen go”失败生成[1]:***[/home/593m/team\u name/zk/internal pkg/go\u source/bin/protoc gen go]错误1生成[1]:离开目录“/home/593m/team\u name/zk/internal pkg/go\u source”生成文件:26:目标配方“all”失败生成:***[全部]错误2

生成文件:

$(repoot)/bin/protoc gen go:$(repoot)/src/nexus。com/vendor/github。com/golang/protobuf/protoc gen go/*。转到cd$(Repoot)/src/nexus。com/vendor/github。com/golang/protobuf/protoc gen go$(GOINSTALL)

$(repoot)/bin/generate\u proto:$(repoot)/bin/protoc gen go$(repoot)/resources/proto/*mkdir-p$(repoot)/src/nexus。com/odc/odcproto在此步骤中生成


共1个答案

匿名用户

尝试将代码从make文件更改为此代码

CURRENT_DIR=$(shell pwd)

build:
    CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -installsuffix cgo -o ${CURRENT_DIR}/bin/${APP} ${APP_CMD_DIR}/main.go

proto-gen:
    ./scripts/gen-proto.sh  ${CURRENT_DIR}
    ls genproto/*.pb.go | xargs -n1 -IX bash -c "sed -e '/bool/ s/,omitempty//' X > X.tmp && mv X{.tmp,}"