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

     1  package fixtures
     2  
     3  import "errors"
     4  
     5  type tt int
     6  
     7  func (t tt) m() {}
     8  
     9  func deferrer3() {
    10  	for {
    11  		go func() {
    12  			defer println()
    13  		}()
    14  		defer func() {}() // MATCH /prefer not to defer inside loops/
    15  	}
    16  
    17  	defer tt.m()
    18  
    19  	defer func() error {
    20  		return errors.New("error")
    21  	}()
    22  
    23  	defer recover()
    24  
    25  	recover()
    26  
    27  	defer deferrer()
    28  }