grpc-gateway icon indicating copy to clipboard operation
grpc-gateway copied to clipboard

Use `debug.ReadBuildInfo()` for retrieving a version

Open Semior001 opened this issue 1 year ago • 0 comments

🚀 Feature

It's a common case when a developers just installs the utility from sources, without retrieving the binary that includes build info, which raises an issue of tracking the utility's version. Tool dependency has no help in here as mostly developers are installing it via running the command above:

$ go install \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
    google.golang.org/protobuf/cmd/protoc-gen-go \
    google.golang.org/grpc/cmd/protoc-gen-go-grpc

which just takes the latest versions of all tools without embedding any information about the utility's build.

I think it's a good idea to retrieve utility's version via debug.ReadBuildInfo, which was added in Go 1.18.

Semior001 avatar Nov 21 '22 15:11 Semior001