chore: fix all golangci-lint warnings

This commit is contained in:
Alec Thomas
2024-12-01 11:12:48 +11:00
parent 5221ebb8fb
commit 88e13d750a
3 changed files with 7 additions and 18 deletions
+4 -16
View File
@@ -7,7 +7,6 @@ output:
linters:
enable-all: true
disable:
- maligned
- lll
- gochecknoglobals
- wsl
@@ -17,11 +16,8 @@ linters:
- goprintffuncname
- paralleltest
- nlreturn
- goerr113
- ifshort
- testpackage
- wrapcheck
- exhaustivestruct
- forbidigo
- gci
- godot
@@ -29,9 +25,6 @@ linters:
- cyclop
- errorlint
- nestif
- golint
- scopelint
- interfacer
- tagliatelle
- thelper
- godox
@@ -41,18 +34,17 @@ linters:
- exhaustruct
- nonamedreturns
- nilnil
- nosnakecase # deprecated since v1.48.1
- structcheck # deprecated since v1.49.0
- deadcode # deprecated since v1.49.0
- varcheck # deprecated since v1.49.0
- depguard # nothing to guard against yet
- tagalign # hurts readability of kong tags
- mnd
- perfsprint
- err113
- copyloopvar
- intrange
- execinquery
linters-settings:
govet:
check-shadowing: true
# These govet checks are disabled by default, but they're useful.
enable:
- niliness
@@ -90,7 +82,3 @@ issues:
# Duplicate words are okay in tests.
- linters: [dupword]
path: _test\.go
- linters: [maintidx]
path: context\.go
text: 'Function name: trace'
+2 -1
View File
@@ -347,6 +347,7 @@ func (c *Context) endParsing() {
}
}
//nolint:maintidx
func (c *Context) trace(node *Node) (err error) { //nolint: gocyclo
positional := 0
node.Active = true
@@ -758,7 +759,7 @@ func (e *unknownFlagError) Error() string { return e.Cause.Error() }
// Call an arbitrary function filling arguments with bound values.
func (c *Context) Call(fn any, binds ...interface{}) (out []interface{}, err error) {
fv := reflect.ValueOf(fn)
bindings := c.Kong.bindings.clone().add(binds...).add(c).merge(c.bindings) //nolint:govet
bindings := c.Kong.bindings.clone().add(binds...).add(c).merge(c.bindings)
return callAnyFunction(fv, bindings)
}
+1 -1
View File
@@ -117,7 +117,7 @@ func New(grammar interface{}, options ...Option) (*Kong, error) {
// Embed any embedded structs.
for _, embed := range k.embedded {
tag, err := parseTagString(strings.Join(embed.tags, " ")) //nolint:govet
tag, err := parseTagString(strings.Join(embed.tags, " "))
if err != nil {
return nil, err
}