mirror of
https://github.com/tailscale/tailscale.git
synced 2025-06-21 15:48:39 +00:00

gocross is not needed like it used to be, now that Go does version stamping itself. We keep it for the xcode and Windows builds for now. This simplifies things in the build, especially with upcoming build system updates. Updates tailscale/corp#28679 Updates tailscale/corp#26717 Change-Id: Ib4bebe6f50f3b9c3d6cd27323fca603e3dfb43cc Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
34 lines
789 B
Go
34 lines
789 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package version
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
"strings"
|
|
"sync"
|
|
)
|
|
|
|
var stringLazy = sync.OnceValue(func() string {
|
|
var ret strings.Builder
|
|
ret.WriteString(Short())
|
|
ret.WriteByte('\n')
|
|
if IsUnstableBuild() {
|
|
fmt.Fprintf(&ret, " track: unstable (dev); frequent updates and bugs are likely\n")
|
|
}
|
|
if gitCommit() != "" {
|
|
fmt.Fprintf(&ret, " tailscale commit: %s%s\n", gitCommit(), dirtyString())
|
|
}
|
|
fmt.Fprintf(&ret, " long version: %s\n", Long())
|
|
if extraGitCommitStamp != "" {
|
|
fmt.Fprintf(&ret, " other commit: %s\n", extraGitCommitStamp)
|
|
}
|
|
fmt.Fprintf(&ret, " go version: %s\n", runtime.Version())
|
|
return strings.TrimSpace(ret.String())
|
|
})
|
|
|
|
func String() string {
|
|
return stringLazy()
|
|
}
|