github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/testutils/testdata/recursiveStartStop.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ks888/tgo/lib/tracer"
     7  )
     8  
     9  func dec(i, rem int) int {
    10  	tracer.Start()
    11  	defer tracer.Stop()
    12  	if rem == 0 {
    13  		return i
    14  	}
    15  	return dec(i-1, rem-1)
    16  }
    17  
    18  func main() {
    19  	tracer.SetTraceLevel(3)
    20  	val := dec(3, 3)
    21  	fmt.Println(val)
    22  }