Skip to content

Commit a855c20

Browse files
authored
chore: bump golangci-lint and semgrep version (#5404)
* chore: bump golangci-lint and semgrep version * fix: delete not allowed property * fix: delete not allowed property * fix: delete golangci-lint deprecated vet * fix: golangci lint run go target version * fix: golangci-lint donot fail fast * fix: code lint * patch: pkg * patch: pkg
1 parent af8a321 commit a855c20

File tree

12 files changed

+39
-28
lines changed

12 files changed

+39
-28
lines changed

.github/workflows/check-semgrep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
container:
3131
# A Docker image with Semgrep installed. Do not change this.
32-
image: returntocorp/semgrep:1.31.2
32+
image: semgrep/semgrep:1.109.0
3333

3434
# allow fails due to too many risks
3535
continue-on-error: true

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
needs: [ resolve-modules ]
5656
runs-on: ubuntu-24.04
5757
strategy:
58+
fail-fast: false
5859
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
5960
steps:
6061
- name: Checkout
@@ -71,6 +72,6 @@ jobs:
7172
- name: Run Linter
7273
uses: golangci/golangci-lint-action@v6
7374
with:
74-
version: v1.54.2
75+
version: v1.64.5
7576
working-directory: ${{ matrix.workdir }}
7677
args: "--out-${NO_FUTURE}format colored-line-number"

.github/workflows/controllers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
needs: [ resolve-modules ]
6767
runs-on: ubuntu-24.04
6868
strategy:
69+
fail-fast: false
6970
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
7071
steps:
7172
- name: Checkout
@@ -80,7 +81,7 @@ jobs:
8081
- name: Run Linter
8182
uses: golangci/golangci-lint-action@v6
8283
with:
83-
version: v1.54.2
84+
version: v1.64.5
8485
working-directory: ${{ matrix.workdir }}
8586
args: "--out-${NO_FUTURE}format colored-line-number"
8687

.github/workflows/services.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
needs: [ resolve-modules ]
6666
runs-on: ubuntu-24.04
6767
strategy:
68+
fail-fast: false
6869
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
6970
steps:
7071
- name: Checkout
@@ -78,7 +79,7 @@ jobs:
7879
- name: Run Linter
7980
uses: golangci/golangci-lint-action@v6
8081
with:
81-
version: v1.54.2
82+
version: v1.64.5
8283
working-directory: ${{ matrix.workdir }}
8384
args: "--out-${NO_FUTURE}format colored-line-number"
8485

.github/workflows/webhooks.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
needs: [ resolve-modules ]
4444
runs-on: ubuntu-24.04
4545
strategy:
46+
fail-fast: false
4647
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
4748
steps:
4849
- name: Checkout
@@ -59,7 +60,7 @@ jobs:
5960
- name: Run Linter
6061
uses: golangci/golangci-lint-action@v6
6162
with:
62-
version: v1.54.2
63+
version: v1.64.5
6364
working-directory: ${{ matrix.workdir }}
6465
args: "--out-${NO_FUTURE}format colored-line-number"
6566

.golangci.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
run:
2+
go: "1.20"
3+
24
# timeout for analysis, e.g. 30s, 5m, default is 1m
35
timeout: 5m
46

57
# include test files or not, default is true
68
tests: true
79

8-
# default is true. Enables skipping of directories:
9-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
10-
skip-dirs-use-default: true
11-
skip-dirs:
10+
modules-download-mode: readonly
11+
12+
issues:
13+
# https://github.com/golangci/golangci-lint/pull/4509
14+
exclude-dirs-use-default: true
15+
exclude-dirs:
1216
- (^|/)fork($|/)
1317
- pkg/registry/save/lib/
14-
modules-download-mode: readonly
1518

1619
linters:
1720
# please, do not use `enable-all`: it's deprecated and will be removed soon.
@@ -27,7 +30,6 @@ linters:
2730
- misspell
2831
- whitespace
2932
- ineffassign
30-
- vet
3133
- typecheck
3234
- errcheck
3335
- govet
@@ -39,13 +41,10 @@ linters:
3941
linters-settings:
4042
errcheck:
4143
check-type-assertions: false
42-
ignore: fmt:.*
4344
exclude-functions:
4445
- io.Copy(*bytes.Buffer)
4546
- io.Copy(os.Stdout)
46-
47-
# golangci.com configuration
48-
# https://github.com/golangci/golangci/wiki/Configuration
49-
service:
50-
# use the fixed version to not introduce new linters unexpectedly
51-
golangci-lint-version: latest
47+
revive:
48+
rules:
49+
- name: dot-imports
50+
disabled: true

pkg/apply/processor/context.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ package processor
1818

1919
import "context"
2020

21-
var commandKey struct{}
21+
var (
22+
commandKey struct{}
23+
envKey struct{}
24+
)
2225

26+
//nolint:staticcheck
2327
func WithCommands(ctx context.Context, commands []string) context.Context {
2428
return context.WithValue(ctx, commandKey, commands)
2529
}
@@ -32,8 +36,7 @@ func GetCommands(ctx context.Context) []string {
3236
return nil
3337
}
3438

35-
var envKey struct{}
36-
39+
//nolint:staticcheck
3740
func WithEnvs(ctx context.Context, envs map[string]string) context.Context {
3841
return context.WithValue(ctx, envKey, envs)
3942
}

service/devbox/middleware/auth.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ func TokenAuth(c *gin.Context) {
2121
}
2222

2323
func parseToken(token string) error {
24-
_, err := jwt.Parse(token, func(token *jwt.Token) (interface{}, error) {
24+
_, err := jwt.Parse(token, func(_ *jwt.Token) (interface{}, error) {
2525
return []byte(os.Getenv("JWTSecret")), nil
2626
})
27-
2827
if err != nil {
2928
return err
3029
}

service/devbox/middleware/auth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func TestAuth(t *testing.T) {
1111
secret, _ := GenerateTokenWithExpiry("1234567890", time.Hour)
12-
t.Logf(secret)
12+
t.Log(secret)
1313
}
1414

1515
// GenerateTokenWithExpiry generates a JWT token with only the expiration time

service/exceptionmonitor/helper/monitor/database_performance_monitor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ func NumberToChinese(num int) string {
195195
return "十" + numToChinese[unitDigit]
196196
} else if unitDigit == 0 {
197197
return numToChinese[tenDigit] + "十"
198-
} else {
199-
return numToChinese[tenDigit] + "十" + numToChinese[unitDigit]
200198
}
199+
return numToChinese[tenDigit] + "十" + numToChinese[unitDigit]
201200
}

0 commit comments

Comments
 (0)