Skip to content

Commit 5e24cb2

Browse files
committed
feat: merge staticcheck, stylecheck, gosimple
1 parent 60ac0dd commit 5e24cb2

29 files changed

+725
-453
lines changed

.golangci.next.reference.yml

Lines changed: 152 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,116 +1334,6 @@ linters:
13341334
# Default: false
13351335
local-replace-directives: false
13361336

1337-
gosimple:
1338-
# Sxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
1339-
# Default: ["*"]
1340-
checks:
1341-
# Use plain channel send or receive instead of single-case select.
1342-
# https://staticcheck.dev/docs/checks/#S1000
1343-
- S1000
1344-
# Replace for loop with call to copy.
1345-
# https://staticcheck.dev/docs/checks/#S1001
1346-
- S1001
1347-
# Omit comparison with boolean constant.
1348-
# https://staticcheck.dev/docs/checks/#S1002
1349-
- S1002
1350-
# Replace call to 'strings.Index' with 'strings.Contains'.
1351-
# https://staticcheck.dev/docs/checks/#S1003
1352-
- S1003
1353-
# Replace call to 'bytes.Compare' with 'bytes.Equal'.
1354-
# https://staticcheck.dev/docs/checks/#S1004
1355-
- S1004
1356-
# Drop unnecessary use of the blank identifier.
1357-
# https://staticcheck.dev/docs/checks/#S1005
1358-
- S1005
1359-
# Use "for { ... }" for infinite loops.
1360-
# https://staticcheck.dev/docs/checks/#S1006
1361-
- S1006
1362-
# Simplify regular expression by using raw string literal.
1363-
# https://staticcheck.dev/docs/checks/#S1007
1364-
- S1007
1365-
# Simplify returning boolean expression.
1366-
# https://staticcheck.dev/docs/checks/#S1008
1367-
- S1008
1368-
# Omit redundant nil check on slices, maps, and channels.
1369-
# https://staticcheck.dev/docs/checks/#S1009
1370-
- S1009
1371-
# Omit default slice index.
1372-
# https://staticcheck.dev/docs/checks/#S1010
1373-
- S1010
1374-
# Use a single 'append' to concatenate two slices.
1375-
# https://staticcheck.dev/docs/checks/#S1011
1376-
- S1011
1377-
# Replace 'time.Now().Sub(x)' with 'time.Since(x)'.
1378-
# https://staticcheck.dev/docs/checks/#S1012
1379-
- S1012
1380-
# Use a type conversion instead of manually copying struct fields.
1381-
# https://staticcheck.dev/docs/checks/#S1016
1382-
- S1016
1383-
# Replace manual trimming with 'strings.TrimPrefix'.
1384-
# https://staticcheck.dev/docs/checks/#S1017
1385-
- S1017
1386-
# Use "copy" for sliding elements.
1387-
# https://staticcheck.dev/docs/checks/#S1018
1388-
- S1018
1389-
# Simplify "make" call by omitting redundant arguments.
1390-
# https://staticcheck.dev/docs/checks/#S1019
1391-
- S1019
1392-
# Omit redundant nil check in type assertion.
1393-
# https://staticcheck.dev/docs/checks/#S1020
1394-
- S1020
1395-
# Merge variable declaration and assignment.
1396-
# https://staticcheck.dev/docs/checks/#S1021
1397-
- S1021
1398-
# Omit redundant control flow.
1399-
# https://staticcheck.dev/docs/checks/#S1023
1400-
- S1023
1401-
# Replace 'x.Sub(time.Now())' with 'time.Until(x)'.
1402-
# https://staticcheck.dev/docs/checks/#S1024
1403-
- S1024
1404-
# Don't use 'fmt.Sprintf("%s", x)' unnecessarily.
1405-
# https://staticcheck.dev/docs/checks/#S1025
1406-
- S1025
1407-
# Simplify error construction with 'fmt.Errorf'.
1408-
# https://staticcheck.dev/docs/checks/#S1028
1409-
- S1028
1410-
# Range over the string directly.
1411-
# https://staticcheck.dev/docs/checks/#S1029
1412-
- S1029
1413-
# Use 'bytes.Buffer.String' or 'bytes.Buffer.Bytes'.
1414-
# https://staticcheck.dev/docs/checks/#S1030
1415-
- S1030
1416-
# Omit redundant nil check around loop.
1417-
# https://staticcheck.dev/docs/checks/#S1031
1418-
- S1031
1419-
# Use 'sort.Ints(x)', 'sort.Float64s(x)', and 'sort.Strings(x)'.
1420-
# https://staticcheck.dev/docs/checks/#S1032
1421-
- S1032
1422-
# Unnecessary guard around call to "delete".
1423-
# https://staticcheck.dev/docs/checks/#S1033
1424-
- S1033
1425-
# Use result of type assertion to simplify cases.
1426-
# https://staticcheck.dev/docs/checks/#S1034
1427-
- S1034
1428-
# Redundant call to 'net/http.CanonicalHeaderKey' in method call on 'net/http.Header'.
1429-
# https://staticcheck.dev/docs/checks/#S1035
1430-
- S1035
1431-
# Unnecessary guard around map access.
1432-
# https://staticcheck.dev/docs/checks/#S1036
1433-
- S1036
1434-
# Elaborate way of sleeping.
1435-
# https://staticcheck.dev/docs/checks/#S1037
1436-
- S1037
1437-
# Unnecessarily complex way of printing formatted string.
1438-
# https://staticcheck.dev/docs/checks/#S1038
1439-
- S1038
1440-
# Unnecessary use of 'fmt.Sprint'.
1441-
# https://staticcheck.dev/docs/checks/#S1039
1442-
- S1039
1443-
# Type assertion to current type.
1444-
# https://staticcheck.dev/docs/checks/#S1040
1445-
- S1040
1446-
14471337
gosec:
14481338
# To select a subset of rules to run.
14491339
# Available rules: https://github.com/securego/gosec#available-rules
@@ -2859,9 +2749,19 @@ linters:
28592749
- "github.com/user/repo/telemetry/trace.Start:opentelemetry"
28602750

28612751
staticcheck:
2752+
# https://staticcheck.dev/docs/configuration/options/#dot_import_whitelist
2753+
# Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"]
2754+
dot-import-whitelist:
2755+
- fmt
2756+
# https://staticcheck.dev/docs/configuration/options/#initialisms
2757+
# Default: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
2758+
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ]
2759+
# https://staticcheck.dev/docs/configuration/options/#http_status_code_whitelist
2760+
# Default: ["200", "400", "404", "500"]
2761+
http-status-code-whitelist: [ "200", "400", "404", "500" ]
28622762
# SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
28632763
# Example (to disable some checks): [ "all", "-SA1000", "-SA1001"]
2864-
# Default: ["*"]
2764+
# Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
28652765
checks:
28662766
# Invalid regular expression.
28672767
# https://staticcheck.dev/docs/checks/#SA1000
@@ -3148,22 +3048,6 @@ linters:
31483048
# Ineffectual Go compiler directive.
31493049
# https://staticcheck.dev/docs/checks/#SA9009
31503050
- SA9009
3151-
3152-
stylecheck:
3153-
# https://staticcheck.dev/docs/configuration/options/#dot_import_whitelist
3154-
# Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"]
3155-
dot-import-whitelist:
3156-
- fmt
3157-
# https://staticcheck.dev/docs/configuration/options/#initialisms
3158-
# Default: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
3159-
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ]
3160-
# https://staticcheck.dev/docs/configuration/options/#http_status_code_whitelist
3161-
# Default: ["200", "400", "404", "500"]
3162-
http-status-code-whitelist: [ "200", "400", "404", "500" ]
3163-
# STxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
3164-
# Example (to disable some checks): [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
3165-
# Default: ["*"]
3166-
checks:
31673051
# Incorrect or missing package comment.
31683052
# https://staticcheck.dev/docs/checks/#ST1000
31693053
- ST1000
@@ -3218,6 +3102,147 @@ linters:
32183102
# Redundant type in variable declaration.
32193103
# https://staticcheck.dev/docs/checks/#ST1023
32203104
- ST1023
3105+
# Use plain channel send or receive instead of single-case select.
3106+
# https://staticcheck.dev/docs/checks/#S1000
3107+
- S1000
3108+
# Replace for loop with call to copy.
3109+
# https://staticcheck.dev/docs/checks/#S1001
3110+
- S1001
3111+
# Omit comparison with boolean constant.
3112+
# https://staticcheck.dev/docs/checks/#S1002
3113+
- S1002
3114+
# Replace call to 'strings.Index' with 'strings.Contains'.
3115+
# https://staticcheck.dev/docs/checks/#S1003
3116+
- S1003
3117+
# Replace call to 'bytes.Compare' with 'bytes.Equal'.
3118+
# https://staticcheck.dev/docs/checks/#S1004
3119+
- S1004
3120+
# Drop unnecessary use of the blank identifier.
3121+
# https://staticcheck.dev/docs/checks/#S1005
3122+
- S1005
3123+
# Use "for { ... }" for infinite loops.
3124+
# https://staticcheck.dev/docs/checks/#S1006
3125+
- S1006
3126+
# Simplify regular expression by using raw string literal.
3127+
# https://staticcheck.dev/docs/checks/#S1007
3128+
- S1007
3129+
# Simplify returning boolean expression.
3130+
# https://staticcheck.dev/docs/checks/#S1008
3131+
- S1008
3132+
# Omit redundant nil check on slices, maps, and channels.
3133+
# https://staticcheck.dev/docs/checks/#S1009
3134+
- S1009
3135+
# Omit default slice index.
3136+
# https://staticcheck.dev/docs/checks/#S1010
3137+
- S1010
3138+
# Use a single 'append' to concatenate two slices.
3139+
# https://staticcheck.dev/docs/checks/#S1011
3140+
- S1011
3141+
# Replace 'time.Now().Sub(x)' with 'time.Since(x)'.
3142+
# https://staticcheck.dev/docs/checks/#S1012
3143+
- S1012
3144+
# Use a type conversion instead of manually copying struct fields.
3145+
# https://staticcheck.dev/docs/checks/#S1016
3146+
- S1016
3147+
# Replace manual trimming with 'strings.TrimPrefix'.
3148+
# https://staticcheck.dev/docs/checks/#S1017
3149+
- S1017
3150+
# Use "copy" for sliding elements.
3151+
# https://staticcheck.dev/docs/checks/#S1018
3152+
- S1018
3153+
# Simplify "make" call by omitting redundant arguments.
3154+
# https://staticcheck.dev/docs/checks/#S1019
3155+
- S1019
3156+
# Omit redundant nil check in type assertion.
3157+
# https://staticcheck.dev/docs/checks/#S1020
3158+
- S1020
3159+
# Merge variable declaration and assignment.
3160+
# https://staticcheck.dev/docs/checks/#S1021
3161+
- S1021
3162+
# Omit redundant control flow.
3163+
# https://staticcheck.dev/docs/checks/#S1023
3164+
- S1023
3165+
# Replace 'x.Sub(time.Now())' with 'time.Until(x)'.
3166+
# https://staticcheck.dev/docs/checks/#S1024
3167+
- S1024
3168+
# Don't use 'fmt.Sprintf("%s", x)' unnecessarily.
3169+
# https://staticcheck.dev/docs/checks/#S1025
3170+
- S1025
3171+
# Simplify error construction with 'fmt.Errorf'.
3172+
# https://staticcheck.dev/docs/checks/#S1028
3173+
- S1028
3174+
# Range over the string directly.
3175+
# https://staticcheck.dev/docs/checks/#S1029
3176+
- S1029
3177+
# Use 'bytes.Buffer.String' or 'bytes.Buffer.Bytes'.
3178+
# https://staticcheck.dev/docs/checks/#S1030
3179+
- S1030
3180+
# Omit redundant nil check around loop.
3181+
# https://staticcheck.dev/docs/checks/#S1031
3182+
- S1031
3183+
# Use 'sort.Ints(x)', 'sort.Float64s(x)', and 'sort.Strings(x)'.
3184+
# https://staticcheck.dev/docs/checks/#S1032
3185+
- S1032
3186+
# Unnecessary guard around call to "delete".
3187+
# https://staticcheck.dev/docs/checks/#S1033
3188+
- S1033
3189+
# Use result of type assertion to simplify cases.
3190+
# https://staticcheck.dev/docs/checks/#S1034
3191+
- S1034
3192+
# Redundant call to 'net/http.CanonicalHeaderKey' in method call on 'net/http.Header'.
3193+
# https://staticcheck.dev/docs/checks/#S1035
3194+
- S1035
3195+
# Unnecessary guard around map access.
3196+
# https://staticcheck.dev/docs/checks/#S1036
3197+
- S1036
3198+
# Elaborate way of sleeping.
3199+
# https://staticcheck.dev/docs/checks/#S1037
3200+
- S1037
3201+
# Unnecessarily complex way of printing formatted string.
3202+
# https://staticcheck.dev/docs/checks/#S1038
3203+
- S1038
3204+
# Unnecessary use of 'fmt.Sprint'.
3205+
# https://staticcheck.dev/docs/checks/#S1039
3206+
- S1039
3207+
# Type assertion to current type.
3208+
# https://staticcheck.dev/docs/checks/#S1040
3209+
- S1040
3210+
# Apply De Morgan's law.
3211+
# https://staticcheck.dev/docs/checks/#QF1001
3212+
- QF1001
3213+
# Convert untagged switch to tagged switch.
3214+
# https://staticcheck.dev/docs/checks/#QF1002
3215+
- QF1002
3216+
# Convert if/else-if chain to tagged switch.
3217+
# https://staticcheck.dev/docs/checks/#QF1003
3218+
- QF1003
3219+
# Use 'strings.ReplaceAll' instead of 'strings.Replace' with 'n == -1'.
3220+
# https://staticcheck.dev/docs/checks/#QF1004
3221+
- QF1004
3222+
# Expand call to 'math.Pow'.
3223+
# https://staticcheck.dev/docs/checks/#QF1005
3224+
- QF1005
3225+
# Lift 'if'+'break' into loop condition.
3226+
# https://staticcheck.dev/docs/checks/#QF1006
3227+
- QF1006
3228+
# Merge conditional assignment into variable declaration.
3229+
# https://staticcheck.dev/docs/checks/#QF1007
3230+
- QF1007
3231+
# Omit embedded fields from selector expression.
3232+
# https://staticcheck.dev/docs/checks/#QF1008
3233+
- QF1008
3234+
# Use 'time.Time.Equal' instead of '==' operator.
3235+
# https://staticcheck.dev/docs/checks/#QF1009
3236+
- QF1009
3237+
# Convert slice of bytes to string when printing it.
3238+
# https://staticcheck.dev/docs/checks/#QF1010
3239+
- QF1010
3240+
# Omit redundant type from variable declaration.
3241+
# https://staticcheck.dev/docs/checks/#QF1011
3242+
- QF1011
3243+
# Use 'fmt.Fprintf(x, ...)' instead of 'x.Write(fmt.Sprintf(...))'.
3244+
# https://staticcheck.dev/docs/checks/#QF1012
3245+
- QF1012
32213246

32223247
tagalign:
32233248
# Align and sort can be used together or separately.

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ linters:
3636
- mnd
3737
- goprintffuncname
3838
- gosec
39-
- gosimple
4039
- govet
4140
- intrange
4241
- ineffassign
@@ -47,7 +46,6 @@ linters:
4746
- nolintlint
4847
- revive
4948
- staticcheck
50-
- stylecheck
5149
- testifylint
5250
- unconvert
5351
- unparam

0 commit comments

Comments
 (0)