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) {
^
This PR enables
gocritic
linter and fixes the following lint issues: