version: make all exported funcs compile-time constant or lazy
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
8b2ae47c31
commit
70a2929a12
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user