github.com/stealthrocket/wzprof@v0.2.1-0.20230830205924-5fa86be5e5b3/testdata/go/twocalls.go (about) 1 package main 2 3 //go:noinline 4 func myalloc1(x int) byte { 5 s := make([]byte, x) 6 return s[len(s)-1] | (byte(x) & 0b11) 7 } 8 9 var global int 10 11 //go:noinline 12 func myalloc2() byte { 13 s := make([]byte, global) 14 return s[len(s)-1] | 0b100 15 } 16 17 func intermediate(x int) byte { 18 return myalloc1(x) 19 } 20 21 func main() { 22 // first call to alloc 23 a := myalloc1(41) 24 // second call to alloc, through inlined function 25 b := intermediate(50) 26 // third call, not inlined 27 global = 100 28 c := myalloc2() 29 30 println(a + b + c) 31 }