1. Download dependent libraries
go get -u google.golang.org/protobuf
2. Manual compilation
-
- Find the location of dependent libraries
ps: Enter the cmd terminal and executego env
to view the value of the GOPATH environment variable
$GOPATH\pkg\mod\github.com\golang\[email protected]\protoc-gen-go
-
- Enter the folder in the first step, enter the cmd terminal, and set the compilation environment
go env -w CGO_ENABLED=0 GOOS=windows GOARCH=amd64
- Manual compilation
go build -o protoc-gen-go.exe main.go
3. Move executable files
Move protoc-gen-go.exe to$GOPATH\bin\
directory