Skip to content

protoc: exec: “protoc-min-version”: executable file not found in $PATH

Problem

When I checkout source code of gogo/protobuf and run make , I see the errors as follow:

go clean ./...
go install ./proto
go install ./gogoproto
go install ./jsonpb
go install ./protoc-gen-gogo
go install ./protoc-gen-gofast
go install ./protoc-gen-gogofast
go install ./protoc-gen-gogofaster
go install ./protoc-gen-gogoslick
go install ./protoc-gen-gostring
go install ./protoc-min-version
go install ./protoc-gen-combo
go install ./gogoreplace
make -C protoc-gen-gogo regenerate
make[1]: Entering directory '/home/daomin/projects/tmp/protobuf/protoc-gen-gogo'
go test --regenerate
--- FAIL: TestGolden (0.00s)
    golden_test.go:340: RUNNING:  protoc-min-version --version=3.0.0 -Itestdata --gogo_out=plugins=grpc,paths=source_relative:/tmp/proto-test3133323594 testdata/deprecated/deprecated.proto
    golden_test.go:346: protoc: exec: "protoc-min-version": executable file not found in $PATH
--- FAIL: TestParameters (0.00s)
    golden_test.go:218: TEST: defaults
    golden_test.go:340: RUNNING:  protoc-min-version --version=3.0.0 -I/tmp/proto-test1998568509 --gogo_out=:/tmp/proto-test1998568509/out /tmp/proto-test1998568509/alpha/a.proto
    golden_test.go:346: protoc: exec: "protoc-min-version": executable file not found in $PATH
FAIL
exit status 1
FAIL	github.com/gogo/protobuf/protoc-gen-gogo	0.004s
make[1]: *** [Makefile:39: regenerate] Error 1
make[1]: Leaving directory '/home/daomin/projects/tmp/protobuf/protoc-gen-gogo'
make: *** [Makefile:67: regenerate] Error 2

Solution

My local environment use gvm to support working with different go version.

I check the $GOPATH and see where the package(protoc-min-version) is installed.

Then switch to the right version.My system go version is 1.17 and I have a gvm go version 1.17, there some mistake. When I switch to go 1.16, the error is gone.

Published in未分类

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *