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

Enable gocritic linter; fix lint issues #1612

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Enable gocritic linter; fix lint issues #1612

merged 1 commit into from
Aug 29, 2023

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Aug 28, 2023

This PR enables gocritic linter and fixes the following lint issues:

args.go:555:2: ifElseChain: rewrite if-else to switch statement (gocritic)
        if idxPercent == -1 {
        ^
args.go:570:3: ifElseChain: rewrite if-else to switch statement (gocritic)
                if c == '%' {
                ^
client.go:1346:34: unslice: could simplify req.Header.userAgent[:] to req.Header.userAgent (gocritic)
                        req.Header.userAgent = append(req.Header.userAgent[:], userAgent...)
                                                      ^
client.go:2306:34: unslice: could simplify req.Header.userAgent[:] to req.Header.userAgent (gocritic)
                        req.Header.userAgent = append(req.Header.userAgent[:], userAgent...)
                                                      ^
client.go:2413:34: unslice: could simplify req.Header.userAgent[:] to req.Header.userAgent (gocritic)
                        req.Header.userAgent = append(req.Header.userAgent[:], userAgent...)
                                                      ^
header.go:1301:3: ifElseChain: rewrite if-else to switch statement (gocritic)
                if caseInsensitiveCompare(strContentType, key) {
                ^
uri.go:691:9: appendAssign: append result not assigned to the same slice (gocritic)
                dst = append(u.requestURI[:0], u.PathOriginal()...)
                      ^
userdata.go:45:7: appendAssign: append result not assigned to the same slice (gocritic)
        *d = append(args, kv)
             ^
bytesconv_test.go:85:9: elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)
        } else {
               ^
header_test.go:1980:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                switch string(key) {
                ^
header_test.go:2001:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                switch string(key) {
                ^
header_test.go:2025:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                switch string(key) {
                ^

@erikdubbelboer erikdubbelboer merged commit 9aa666e into valyala:master Aug 29, 2023
14 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

@alexandear alexandear deleted the lint-enable-gocritic branch August 30, 2023 10:51
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.

2 participants