1 package inittest 2 3 // counter is set by init(), which `moxie test` must run before any test body: 4 // the synthetic main it builds around this library is a main package, so a 5 // program's rule (init() is not allowed in main) does not apply, and the 6 // __varinit call alone left counter at zero. 7 var counter int32 8 9 func init() { 10 counter = 42 11 } 12 13 func Counter() (n int32) { 14 return counter 15 } 16