Windows installation protoc-gen-go

1. Download dependent libraries

 go get -u google.golang.org/protobuf 

2. Manual compilation

    1. 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
    1. 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

おすすめ

転載: blog.csdn.net/qq_36940806/article/details/135017748