github.com/azazeal/revive@v1.0.9/testdata/defer-loop-disabled.go (about)

     1  package fixtures
     2  
     3  import "errors"
     4  
     5  type tt int
     6  
     7  func (t tt) m() {}
     8  
     9  func deferrer1() {
    10  	for {
    11  		go func() {
    12  			defer println()
    13  		}()
    14  		defer func() {}()
    15  	}
    16  
    17  	defer tt.m() // MATCH /be careful when deferring calls to methods without pointer receiver/
    18  
    19  	defer func() error {
    20  		return errors.New("error") //MATCH /return in a defer function has no effect/
    21  	}()
    22  
    23  	defer recover()
    24  
    25  	recover() //MATCH /recover must be called inside a deferred function/
    26  
    27  	defer deferrer()
    28  }