mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-30 05:25:35 +00:00
70a2929a12
Signed-off-by: David Anderson <danderson@tailscale.com>
34 lines
758 B
Go
34 lines
758 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package version
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
"strings"
|
|
|
|
"tailscale.com/types/lazy"
|
|
)
|
|
|
|
var stringLazy = lazy.SyncFunc(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())
|
|
}
|
|
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()
|
|
}
|