github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/goconst_calls_enabled.go (about)

     1  //golangcitest:args -Egoconst
     2  //golangcitest:config_path testdata/configs/goconst_calls_enabled.yml
     3  package testdata
     4  
     5  import "fmt"
     6  
     7  const FooBar = "foobar"
     8  
     9  func Baz() {
    10  	a := "foobar" // want "string `foobar` has 4 occurrences, but such constant `FooBar` already exists"
    11  	fmt.Print(a)
    12  	b := "foobar"
    13  	fmt.Print(b)
    14  	c := "foobar"
    15  	fmt.Print(c)
    16  	fmt.Print("foobar")
    17  }