Closed zhaolibo1989 closed 2 weeks ago
使用go install github.com/golang/protobuf/protoc-gen-go
后,protoc-gen-go
不能单独查看版本号。
C:\Users\Administrator>protoc-gen-go --version
protoc-gen-go: unknown argument "--version" (this program should be run by protoc, not directly)
生成的 *.go 中提示的 protoc-gen-go 版本有变化。
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0 ****这里原来是 v1.29.1
// protoc v4.22.0
// source: conversation/conversation.proto
试图 go install 指定 v1.29.1 版本号安装时,提示没有这个版本。如何控制这个版本,原文件的 v1.29.1 版本是哪里来的?
C:\Users\Administrator>go install github.com/golang/protobuf/protoc-gen-go@v1.29.1
go: github.com/golang/protobuf/protoc-gen-go@v1.29.1: github.com/golang/protobuf/protoc-gen-go@v1.29.1: invalid version: unknown revision protoc-gen-go/v1.29.1
使用 v1.31.0 版本的 protoc-gen-go 生成的 go 文件对 protocol 的使用有什么影响?
got it
I have also encountered this problem.
I solve to use go install github.com/golang/protobuf/protoc-gen-go@latest
. It work it.
So anyone have this problem. You can refer to the article mentioned in the previous comment.
使用
go install github.com/golang/protobuf/protoc-gen-go
后,protoc-gen-go
不能单独查看版本号。C:\Users\Administrator>protoc-gen-go --version protoc-gen-go: unknown argument "--version" (this program should be run by protoc, not directly)
生成的 *.go 中提示的 protoc-gen-go 版本有变化。
// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 ****这里原来是 v1.29.1 // protoc v4.22.0 // source: conversation/conversation.proto
试图 go install 指定 v1.29.1 版本号安装时,提示没有这个版本。如何控制这个版本,原文件的 v1.29.1 版本是哪里来的?
C:\Users\Administrator>go install github.com/golang/protobuf/protoc-gen-go@v1.29.1 go: github.com/golang/protobuf/protoc-gen-go@v1.29.1: github.com/golang/protobuf/protoc-gen-go@v1.29.1: invalid version: unknown revision protoc-gen-go/v1.29.1
使用 v1.31.0 版本的 protoc-gen-go 生成的 go 文件对 protocol 的使用有什么影响?
you can find version in here. also everyone package you can find in pkg.go.dev.
So I have to answer the question. First, update protoc-gen-go
usually is not breaking change. It is not problem. Just use proto
file generate corresponding go file. So you worry the version.
What would you like to share?
I use
gen.cmd
to generate *.go, but get errors as follow:Additional information
I use 'protoc --go-grpc_out=...' to generate gRPC, and then, failed again.