github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/testutils/testdata/startStop.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/ks888/tgo/lib/tracer" 7 ) 8 9 //go:noinline 10 func tracedFunc() []int { 11 fmt.Println("traced") 12 return nil 13 } 14 15 func main() { 16 tracer.SetVerboseOption(true) 17 tracer.SetTraceLevel(2) 18 if err := tracer.Start(); err != nil { 19 panic(err) 20 } 21 22 fmt.Println("traced") 23 24 arr := tracedFunc() 25 arr = append(arr, 1) 26 27 tracer.Stop() 28 29 fmt.Println("not traced", arr) 30 31 // start again 32 if err := tracer.Start(); err != nil { 33 panic(err) 34 } 35 }