logpolicy: add -race suffix to Go version when race detector in use

This commit is contained in:
Brad Fitzpatrick 2020-11-16 10:13:06 -08:00
parent ff50ddf1ee
commit 51c8fd1dfc
2 changed files with 11 additions and 1 deletions

View File

@ -87,6 +87,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
W tailscale.com/util/endian from tailscale.com/net/netns+
tailscale.com/util/lineread from tailscale.com/control/controlclient+
tailscale.com/util/pidowner from tailscale.com/ipn/ipnserver
tailscale.com/util/racebuild from tailscale.com/logpolicy
tailscale.com/version from tailscale.com/cmd/tailscaled+
tailscale.com/version/distro from tailscale.com/control/controlclient+
tailscale.com/wgengine from tailscale.com/cmd/tailscaled+

View File

@ -35,6 +35,7 @@
"tailscale.com/paths"
"tailscale.com/smallzstd"
"tailscale.com/types/logger"
"tailscale.com/util/racebuild"
"tailscale.com/version"
)
@ -396,7 +397,7 @@ func New(collection string) *Policy {
log.Printf("Program starting: v%v, Go %v: %#v",
version.Long,
strings.TrimPrefix(runtime.Version(), "go"),
goVersion(),
os.Args)
log.Printf("LogID: %v", newc.PublicID)
if filchErr != nil {
@ -479,3 +480,11 @@ func newLogtailTransport(host string) *http.Transport {
return tr
}
func goVersion() string {
v := strings.TrimPrefix(runtime.Version(), "go")
if racebuild.On {
return v + "-race"
}
return v
}