mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
Bump github.com/jgautheron/goconst from 0.5.6 to 0.5.7(#2044)
This commit is contained in:
parent
2862ca630c
commit
52b55141c4
6 changed files with 77 additions and 5 deletions
36
test/testdata/goconst_dont_ignore_test.go
vendored
Normal file
36
test/testdata/goconst_dont_ignore_test.go
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
//args: -Egoconst
|
||||
//config: linters-settings.goconst.ignore-tests=false
|
||||
package testdata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGoConstA(t *testing.T) {
|
||||
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 TestGoConstB(t *testing.T) {
|
||||
a := "needconst"
|
||||
fmt.Print(a)
|
||||
b := "needconst"
|
||||
fmt.Print(b)
|
||||
}
|
||||
|
||||
const AlreadyHasConst = "alreadyhasconst"
|
||||
|
||||
func TestGoConstC(t *testing.T) {
|
||||
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)
|
||||
fmt.Print("alreadyhasconst")
|
||||
}
|
36
test/testdata/goconst_ignore_test.go
vendored
Normal file
36
test/testdata/goconst_ignore_test.go
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
//args: -Egoconst
|
||||
//config: linters-settings.goconst.ignore-tests=true
|
||||
package testdata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGoConstA(t *testing.T) {
|
||||
a := "needconst"
|
||||
fmt.Print(a)
|
||||
b := "needconst"
|
||||
fmt.Print(b)
|
||||
c := "needconst"
|
||||
fmt.Print(c)
|
||||
}
|
||||
|
||||
func TestGoConstB(t *testing.T) {
|
||||
a := "needconst"
|
||||
fmt.Print(a)
|
||||
b := "needconst"
|
||||
fmt.Print(b)
|
||||
}
|
||||
|
||||
const AlreadyHasConst = "alreadyhasconst"
|
||||
|
||||
func TestGoConstC(t *testing.T) {
|
||||
a := "alreadyhasconst"
|
||||
fmt.Print(a)
|
||||
b := "alreadyhasconst"
|
||||
fmt.Print(b)
|
||||
c := "alreadyhasconst"
|
||||
fmt.Print(c)
|
||||
fmt.Print("alreadyhasconst")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue