version: make all exported funcs compile-time constant or lazy

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2023-02-10 18:07:37 -08:00
committed by Dave Anderson
parent 8b2ae47c31
commit 70a2929a12
9 changed files with 240 additions and 183 deletions
+10
View File
@@ -9,6 +9,7 @@ import (
"testing"
ts "tailscale.com"
"tailscale.com/version"
)
func TestAlpineTag(t *testing.T) {
@@ -39,3 +40,12 @@ func readAlpineTag(t *testing.T, file string) string {
}
return ""
}
func TestShortAllocs(t *testing.T) {
allocs := int(testing.AllocsPerRun(10000, func() {
_ = version.Short()
}))
if allocs > 0 {
t.Errorf("allocs = %v; want 0", allocs)
}
}