MCPcopy Index your code
hub / github.com/tailscale/tailscale / readAlpineTag

Function readAlpineTag

version/version_test.go:30–44  ·  view source on GitHub ↗
(t *testing.T, file string)

Source from the content-addressed store, hash-verified

28}
29
30func readAlpineTag(t *testing.T, file string) string {
31 f, err := os.ReadFile(file)
32 if err != nil {
33 t.Fatal(err)
34 }
35 for line := range bytes.SplitSeq(f, []byte{'\n'}) {
36 line = bytes.TrimSpace(line)
37 _, suf, ok := bytes.Cut(line, []byte("FROM alpine:"))
38 if !ok {
39 continue
40 }
41 return string(suf)
42 }
43 return ""
44}
45
46func TestShortAllocs(t *testing.T) {
47 allocs := int(testing.AllocsPerRun(10000, func() {

Callers 1

TestAlpineTagFunction · 0.85

Calls 2

ReadFileMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…