github.com/azazeal/revive@v1.0.9/testdata/bare-return.go (about)

     1  package fixtures
     2  
     3  func bare1() (int, int, error) {
     4  	go func() (a int) {
     5  		return // MATCH /avoid using bare returns, please add return expressions/
     6  	}(5)
     7  }
     8  
     9  func bare2(a, b int) (int, error, int) {
    10  	defer func() (a int) {
    11  		return // MATCH /avoid using bare returns, please add return expressions/
    12  	}(5)
    13  }
    14  
    15  func bare3(a string, b int) (a int, b float32, c string, d string) {
    16  	go func() (a int, b int) {
    17  		return a, b
    18  	}(5, 6)
    19  
    20  	defer func() (a int) {
    21  		return a
    22  	}(5)
    23  
    24  	return // MATCH /avoid using bare returns, please add return expressions/
    25  }
    26  
    27  func bare4(a string, b int) string {
    28  	return a
    29  }
    30  
    31  func bare5(a string, b int) {
    32  	return
    33  }
    34  
    35  // NR tests for issue #280
    36  func f280_1() (err error) {
    37  	func() {
    38  		return
    39  	}()
    40  
    41  	return nil
    42  }
    43  
    44  func f280_2() (err error) {
    45  	func() (r int) {
    46  		return // MATCH /avoid using bare returns, please add return expressions/
    47  	}()
    48  
    49  	return nil
    50  }
    51  
    52  func f280_3() (err error) {
    53  	func() (r int) {
    54  		return 1
    55  	}()
    56  
    57  	return // MATCH /avoid using bare returns, please add return expressions/
    58  }
    59  
    60  func f280_4() (err error) {
    61  	func() (r int) {
    62  		return func() (r int) {
    63  			return // MATCH /avoid using bare returns, please add return expressions/
    64  		}()
    65  	}()
    66  
    67  	return nil
    68  }