github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/deferloop/testdata/src/a/a.go (about)

     1  // Copyright (C) 2021 Storj Labs, Inc.
     2  // See LICENSE for copying information.
     3  
     4  package a
     5  
     6  func _() {
     7  	for {
     8  		defer func() {}() // want "defer inside a loop"
     9  	}
    10  }
    11  func _() {
    12  	for {
    13  		defer func() { // want "defer inside a loop"
    14  			defer func() {}()
    15  		}()
    16  	}
    17  }
    18  
    19  func _() {
    20  	for {
    21  		_ = func() {
    22  			defer func() {}()
    23  		}
    24  	}
    25  }
    26  
    27  func _() {
    28  	for {
    29  		func() {
    30  			defer func() {}()
    31  		}()
    32  	}
    33  }
    34  
    35  func _() {
    36  	for {
    37  		x := func() int {
    38  			defer func() {}()
    39  			return 0
    40  		}()
    41  		_ = x
    42  	}
    43  }