MCPcopy Create free account
hub / github.com/bracesdev/errtrace / readBuildSHA

Function readBuildSHA

cmd/errtrace/toolexec.go:290–308  ·  view source on GitHub ↗

readBuildSHA returns the VCS SHA, if it's from an unmodified VCS state.

()

Source from the content-addressed store, hash-verified

288
289// readBuildSHA returns the VCS SHA, if it's from an unmodified VCS state.
290func readBuildSHA() (_ string, ok bool) {
291 buildInfo, ok := debug.ReadBuildInfo()
292 if !ok {
293 return "", false
294 }
295
296 var sha string
297 for _, s := range buildInfo.Settings {
298 switch s.Key {
299 case "vcs.revision":
300 sha = s.Value
301 case "vcs.modified":
302 if s.Value != "false" {
303 return "", false
304 }
305 }
306 }
307 return sha, sha != ""
308}
309
310// isStdLib checks if the current execution is for stdlib.
311func isStdLib(args []string) bool {

Callers 1

binaryVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected