0

we are trying to build an application, but unable to generate the code using protoc-gen-go

$ make

go version go1.18 linux/amd64

/usr/local/go/bin/go

make -C go_source all

make[1]: Entering directory '/home/593m/team_name/zk/internal-pkg/go_source' cd /home/593m/team_name/zk/internal-pkg/go_source//src/nexus.com/vendor/github.com/golang/protobuf/protoc-gen-go; go install without -mod=vendor, directory /home/593m/team_name/zk/internal-pkg/go_source/src/appnexus.com/vendor/github.com/golang/protobuf/protoc-gen-go has no package path Makefile:72: recipe for target '/home/593m/team_name/zk/internal-pkg/go_source/bin/protoc-gen-go' failed make[1]: *** [/home/593m/team_name/zk/internal-pkg/go_source/bin/protoc-gen-go] Error 1 make[1]: Leaving directory '/home/593m/team_name/zk/internal-pkg/go_source'' Makefile:26: recipe for target 'all' failed make: *** [all] Error 2

Make file :

$(REPOROOT)/bin/protoc-gen-go: $(REPOROOT)/src/nexus.com/vendor/github.com/golang/protobuf/protoc-gen-go/*.go cd $(REPOROOT)/src/nexus.com/vendor/github.com/golang/protobuf/protoc-gen-go; $(GOINSTALL)

$(REPOROOT)/bin/generate_proto: $(REPOROOT)/bin/protoc-gen-go $(REPOROOT)/resources/proto/* mkdir -p $(REPOROOT)/src/nexus.com/odc/odcproto #######ODCPROTO gets generated in this step

2
  • Also its working fine with golang version 1.12 and issue persists only with version 1.18 Commented Jun 2, 2022 at 12:03
  • the github.com url is deprecated, you should try to update and use google.golang.org/protobuf/cmd/protoc-gen-go Commented Jun 2, 2022 at 14:23

1 Answer 1

0

Try to change the code from make file to this code

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,}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.