github.com/azazeal/revive@v1.0.9/testdata/add-constant.go (about)

     1  package fixtures
     2  
     3  func foo(a, b, c, d int) {
     4  	a = 1.0 // ignore
     5  	b = "ignore"
     6  	c = 2              // ignore
     7  	println("lit", 12) // MATCH /avoid magic numbers like '12', create a named constant for it/
     8  	if a == 12.50 {    // MATCH /avoid magic numbers like '12.50', create a named constant for it/
     9  		if b == "lit" {
    10  			c = "lit" // MATCH /string literal "lit" appears, at least, 3 times, create a named constant for it/
    11  		}
    12  		for i := 0; i < 1; i++ {
    13  			println("lit")
    14  		}
    15  	}
    16  }