version: fix version output for "go run"

Before (note attempted use of absent date and commit hash):

"short": "1.37.0-dev",
"long": "1.37.0-dev-t",

After:

"short": "1.37.0-ERR-BuildInfo",
"long": "1.37.0-ERR-BuildInfo",

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/7258/head
David Anderson 2 years ago committed by Dave Anderson
parent 70a2929a12
commit b64d900f0f

@ -134,6 +134,11 @@ var getEmbeddedInfo = lazy.SyncFunc(func() embeddedInfo {
ret.dirty = true
}
}
if ret.commit == "" || ret.commitDate == "" {
// Build info is present in the binary, but has no useful data. Act as
// if it's missing.
return embeddedInfo{}
}
return ret
})

Loading…
Cancel
Save