golangci-lint: Upgrade, fix issues (#397)
The golangci-lint being used was quite dated. This change upgrades to the latest version. Adds and updates exclusions based on new failures. Note on revive: I've included an opt-out for unused parameters for revive because turning `newThing(required bool)` to `newThing(_ bool)` is a loss of useful information. The changes to the Go files are to fix the following issues: ``` camelcase.go:16: File is not `gofmt`-ed with `-s` (gofmt) config_test.go:50:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint) defaults_test.go:28:25: G601: Implicit memory aliasing in for loop. (gosec) doc.go:5: File is not `gofmt`-ed with `-s` (gofmt) kong.go:446:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint) kong_test.go:503:20: G601: Implicit memory aliasing in for loop. (gosec) model.go:493:10: composites: reflect.ValueError struct literal uses unkeyed fields (govet) scanner.go:112: File is not `gofmt`-ed with `-s` (gofmt) ``` And to address broken nolint directives reported as follows by golangci-lint. ``` [.. skipped .. ] tag.go:65:1: directive `// nolint:gocyclo` should be written without leading space as `//nolint:gocyclo` (nolintlint) tag.go:206:51: directive `// nolint: gocyclo` should be written without leading space as `//nolint: gocyclo` (nolintlint) util_test.go:23:43: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint) util_test.go:51:22: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint) ```
This commit is contained in:
+8
-8
@@ -356,14 +356,14 @@ func TestNumbers(t *testing.T) {
|
||||
_, err := p.Parse([]string{
|
||||
"--f-32", fmt.Sprintf("%v", math.MaxFloat32),
|
||||
"--f-64", fmt.Sprintf("%v", math.MaxFloat64),
|
||||
"--i-8", fmt.Sprintf("%v", int8(math.MaxInt8)),
|
||||
"--i-16", fmt.Sprintf("%v", int16(math.MaxInt16)),
|
||||
"--i-32", fmt.Sprintf("%v", int32(math.MaxInt32)),
|
||||
"--i-64", fmt.Sprintf("%v", int64(math.MaxInt64)),
|
||||
"--u-8", fmt.Sprintf("%v", uint8(math.MaxUint8)),
|
||||
"--u-16", fmt.Sprintf("%v", uint16(math.MaxUint16)),
|
||||
"--u-32", fmt.Sprintf("%v", uint32(math.MaxUint32)),
|
||||
"--u-64", fmt.Sprintf("%v", uint64(math.MaxUint64)),
|
||||
"--i-8", fmt.Sprintf("%v", int8(math.MaxInt8)), //nolint:perfsprint // want int8
|
||||
"--i-16", fmt.Sprintf("%v", int16(math.MaxInt16)), //nolint:perfsprint // want int16
|
||||
"--i-32", fmt.Sprintf("%v", int32(math.MaxInt32)), //nolint:perfsprint // want int32
|
||||
"--i-64", fmt.Sprintf("%v", int64(math.MaxInt64)), //nolint:perfsprint // want int64
|
||||
"--u-8", fmt.Sprintf("%v", uint8(math.MaxUint8)), //nolint:perfsprint // want uint8
|
||||
"--u-16", fmt.Sprintf("%v", uint16(math.MaxUint16)), //nolint:perfsprint // want uint16
|
||||
"--u-32", fmt.Sprintf("%v", uint32(math.MaxUint32)), //nolint:perfsprint // want uint32
|
||||
"--u-64", fmt.Sprintf("%v", uint64(math.MaxUint64)), //nolint:perfsprint // want uint64
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, CLI{
|
||||
|
||||
Reference in New Issue
Block a user