Skip to content

Commit e564cce

Browse files
authored
feat: merge staticcheck, stylecheck, gosimple (#5487)
1 parent 60ac0dd commit e564cce

33 files changed

+731
-463
lines changed

.golangci.next.reference.yml

+152-131
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ linters:
6262
- gomodguard
6363
- goprintffuncname
6464
- gosec
65-
- gosimple
6665
- gosmopolitan
6766
- govet
6867
- grouper
@@ -105,7 +104,6 @@ linters:
105104
- spancheck
106105
- sqlclosecheck
107106
- staticcheck
108-
- stylecheck
109107
- tagalign
110108
- tagliatelle
111109
- testableexamples
@@ -175,7 +173,6 @@ linters:
175173
- gomodguard
176174
- goprintffuncname
177175
- gosec
178-
- gosimple
179176
- gosmopolitan
180177
- govet
181178
- grouper
@@ -218,7 +215,6 @@ linters:
218215
- spancheck
219216
- sqlclosecheck
220217
- staticcheck
221-
- stylecheck
222218
- tagalign
223219
- tagliatelle
224220
- testableexamples
@@ -1334,116 +1330,6 @@ linters:
13341330
# Default: false
13351331
local-replace-directives: false
13361332

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-
14471333
gosec:
14481334
# To select a subset of rules to run.
14491335
# Available rules: https://github.com/securego/gosec#available-rules
@@ -2859,9 +2745,19 @@ linters:
28592745
- "github.com/user/repo/telemetry/trace.Start:opentelemetry"
28602746

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

32223243
tagalign:
32233244
# Align and sort can be used together or separately.

.golangci.yml

-2
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

assets/github-action-config-v1.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/github-action-config.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)