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

pull/933/head
Brad Fitzpatrick 4 years ago
parent ff50ddf1ee
commit 51c8fd1dfc

@ -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+ W tailscale.com/util/endian from tailscale.com/net/netns+
tailscale.com/util/lineread from tailscale.com/control/controlclient+ tailscale.com/util/lineread from tailscale.com/control/controlclient+
tailscale.com/util/pidowner from tailscale.com/ipn/ipnserver 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 from tailscale.com/cmd/tailscaled+
tailscale.com/version/distro from tailscale.com/control/controlclient+ tailscale.com/version/distro from tailscale.com/control/controlclient+
tailscale.com/wgengine from tailscale.com/cmd/tailscaled+ tailscale.com/wgengine from tailscale.com/cmd/tailscaled+

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

Loading…
Cancel
Save