
ed64e33c8c8bc9a919e2b85a1a08225b5ae59d70. Also add tests for local mode of goimports and do refactoring of tests.
32 lines
603 B
Go
32 lines
603 B
Go
//args: -Egoconst
|
|
package testdata
|
|
|
|
import "fmt"
|
|
|
|
func GoconstA() {
|
|
a := "needconst" // ERROR "string `needconst` has 5 occurrences, make it a constant"
|
|
fmt.Print(a)
|
|
b := "needconst"
|
|
fmt.Print(b)
|
|
c := "needconst"
|
|
fmt.Print(c)
|
|
}
|
|
|
|
func GoconstB() {
|
|
a := "needconst"
|
|
fmt.Print(a)
|
|
b := "needconst"
|
|
fmt.Print(b)
|
|
}
|
|
|
|
const AlreadyHasConst = "alreadyhasconst"
|
|
|
|
func GoconstC() {
|
|
a := "alreadyhasconst" // ERROR "string `alreadyhasconst` has 3 occurrences, but such constant `AlreadyHasConst` already exists"
|
|
fmt.Print(a)
|
|
b := "alreadyhasconst"
|
|
fmt.Print(b)
|
|
c := "alreadyhasconst"
|
|
fmt.Print(c)
|
|
}
|