Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix gocritic lint issues #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexandear
Copy link

The PR fixes the following issues:

❯ golangci-lint run
decode_hooks.go:281:2: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
        switch t {
        ^
mapstructure.go:1026:11: elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)
                        } else {
                               ^
mapstructure.go:786:3: ifElseChain: rewrite if-else to switch statement (gocritic)
                if err == nil {
                ^
mapstructure.go:1010:7: wrapperFunc: suggestion: strings.Contains(tagValue[index+1:], "omitempty") (gocritic)
                        if strings.Index(tagValue[index+1:], "omitempty") != -1 && isEmptyValue(v) {
                           ^
mapstructure.go:1027:8: wrapperFunc: suggestion: strings.Contains(tagValue[index+1:], "remain") (gocritic)
                                if strings.Index(tagValue[index+1:], "remain") != -1 {
                                   ^
mapstructure_bugs_test.go:517:5: assignOp: replace `nanos = nanos % 1000000000` with `nanos %= 1000000000` (gocritic)
                                nanos = nanos % 1000000000
                                ^
mapstructure_examples_test.go:321:4: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                        switch f.Kind() {
                        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant