gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/version/fixbuild.go (about)

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