mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-04-17 11:42:38 +00:00
cmd/protoc-gen-go: remove go version from header
The Go toolchain version isn't particularly interesting; short of bugs in the toolchain, the protoc-gen-go output should be identical for any version of the compiler and stdlib. Including it introduces pointless variance in generated output when switching between compiler versions. Change-Id: I74a709cf227ecf68dd62579947e03c07349f04de Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/193122 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
parent
6663f3a630
commit
0e00e666b1
@ -11,7 +11,6 @@ import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"math"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
@ -216,13 +215,8 @@ func genGeneratedHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, f *file
|
||||
if v := gen.Request.GetCompilerVersion(); v != nil {
|
||||
protocVersion = fmt.Sprintf("v%v.%v.%v", v.GetMajor(), v.GetMinor(), v.GetPatch())
|
||||
}
|
||||
goVersion := runtime.Version()
|
||||
if strings.HasPrefix(goVersion, "go") {
|
||||
goVersion = "v" + goVersion[len("go"):]
|
||||
}
|
||||
g.P("// \tprotoc-gen-go ", protocGenGoVersion)
|
||||
g.P("// \tprotoc ", protocVersion)
|
||||
g.P("// \tgo ", goVersion)
|
||||
}
|
||||
|
||||
if f.Proto.GetOptions().GetDeprecated() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user