github.com/undoio/delve@v1.9.0/pkg/version/fixbuild.go (about) 1 //go:build go1.18 2 // +build go1.18 3 4 package version 5 6 import "runtime/debug" 7 8 func init() { 9 fixBuild = buildInfoFixBuild 10 } 11 12 func buildInfoFixBuild(v *Version) { 13 info, ok := debug.ReadBuildInfo() 14 if !ok { 15 return 16 } 17 for i := range info.Settings { 18 if info.Settings[i].Key == "gitrevision" { 19 v.Build = info.Settings[i].Value 20 break 21 } 22 } 23 }