mirror of
https://github.com/labring/sealos.git
synced 2026-09-01 15:38:06 +08:00
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
This commit is contained in:
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
container:
|
||||
# A Docker image with Semgrep installed. Do not change this.
|
||||
image: returntocorp/semgrep:1.31.2
|
||||
image: semgrep/semgrep:1.109.0
|
||||
|
||||
# allow fails due to too many risks
|
||||
continue-on-error: true
|
||||
|
||||
@@ -55,6 +55,7 @@ jobs:
|
||||
needs: [ resolve-modules ]
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -71,6 +72,6 @@ jobs:
|
||||
- name: Run Linter
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.54.2
|
||||
version: v1.64.5
|
||||
working-directory: ${{ matrix.workdir }}
|
||||
args: "--out-${NO_FUTURE}format colored-line-number"
|
||||
|
||||
@@ -66,6 +66,7 @@ jobs:
|
||||
needs: [ resolve-modules ]
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -80,7 +81,7 @@ jobs:
|
||||
- name: Run Linter
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.54.2
|
||||
version: v1.64.5
|
||||
working-directory: ${{ matrix.workdir }}
|
||||
args: "--out-${NO_FUTURE}format colored-line-number"
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ jobs:
|
||||
needs: [ resolve-modules ]
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -78,7 +79,7 @@ jobs:
|
||||
- name: Run Linter
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.54.2
|
||||
version: v1.64.5
|
||||
working-directory: ${{ matrix.workdir }}
|
||||
args: "--out-${NO_FUTURE}format colored-line-number"
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ jobs:
|
||||
needs: [ resolve-modules ]
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -59,7 +60,7 @@ jobs:
|
||||
- name: Run Linter
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.54.2
|
||||
version: v1.64.5
|
||||
working-directory: ${{ matrix.workdir }}
|
||||
args: "--out-${NO_FUTURE}format colored-line-number"
|
||||
|
||||
|
||||
+12
-13
@@ -1,17 +1,20 @@
|
||||
run:
|
||||
go: "1.20"
|
||||
|
||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||
timeout: 5m
|
||||
|
||||
# include test files or not, default is true
|
||||
tests: true
|
||||
|
||||
# default is true. Enables skipping of directories:
|
||||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||
skip-dirs-use-default: true
|
||||
skip-dirs:
|
||||
modules-download-mode: readonly
|
||||
|
||||
issues:
|
||||
# https://github.com/golangci/golangci-lint/pull/4509
|
||||
exclude-dirs-use-default: true
|
||||
exclude-dirs:
|
||||
- (^|/)fork($|/)
|
||||
- pkg/registry/save/lib/
|
||||
modules-download-mode: readonly
|
||||
|
||||
linters:
|
||||
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||
@@ -27,7 +30,6 @@ linters:
|
||||
- misspell
|
||||
- whitespace
|
||||
- ineffassign
|
||||
- vet
|
||||
- typecheck
|
||||
- errcheck
|
||||
- govet
|
||||
@@ -39,13 +41,10 @@ linters:
|
||||
linters-settings:
|
||||
errcheck:
|
||||
check-type-assertions: false
|
||||
ignore: fmt:.*
|
||||
exclude-functions:
|
||||
- io.Copy(*bytes.Buffer)
|
||||
- io.Copy(os.Stdout)
|
||||
|
||||
# golangci.com configuration
|
||||
# https://github.com/golangci/golangci/wiki/Configuration
|
||||
service:
|
||||
# use the fixed version to not introduce new linters unexpectedly
|
||||
golangci-lint-version: latest
|
||||
revive:
|
||||
rules:
|
||||
- name: dot-imports
|
||||
disabled: true
|
||||
|
||||
@@ -18,8 +18,12 @@ package processor
|
||||
|
||||
import "context"
|
||||
|
||||
var commandKey struct{}
|
||||
var (
|
||||
commandKey struct{}
|
||||
envKey struct{}
|
||||
)
|
||||
|
||||
//nolint:staticcheck
|
||||
func WithCommands(ctx context.Context, commands []string) context.Context {
|
||||
return context.WithValue(ctx, commandKey, commands)
|
||||
}
|
||||
@@ -32,8 +36,7 @@ func GetCommands(ctx context.Context) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
var envKey struct{}
|
||||
|
||||
//nolint:staticcheck
|
||||
func WithEnvs(ctx context.Context, envs map[string]string) context.Context {
|
||||
return context.WithValue(ctx, envKey, envs)
|
||||
}
|
||||
|
||||
@@ -21,10 +21,9 @@ func TokenAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
func parseToken(token string) error {
|
||||
_, err := jwt.Parse(token, func(token *jwt.Token) (interface{}, error) {
|
||||
_, err := jwt.Parse(token, func(_ *jwt.Token) (interface{}, error) {
|
||||
return []byte(os.Getenv("JWTSecret")), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
func TestAuth(t *testing.T) {
|
||||
secret, _ := GenerateTokenWithExpiry("1234567890", time.Hour)
|
||||
t.Logf(secret)
|
||||
t.Log(secret)
|
||||
}
|
||||
|
||||
// GenerateTokenWithExpiry generates a JWT token with only the expiration time
|
||||
|
||||
@@ -195,7 +195,6 @@ func NumberToChinese(num int) string {
|
||||
return "十" + numToChinese[unitDigit]
|
||||
} else if unitDigit == 0 {
|
||||
return numToChinese[tenDigit] + "十"
|
||||
} else {
|
||||
return numToChinese[tenDigit] + "十" + numToChinese[unitDigit]
|
||||
}
|
||||
return numToChinese[tenDigit] + "十" + numToChinese[unitDigit]
|
||||
}
|
||||
|
||||
@@ -391,6 +391,7 @@ cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgG
|
||||
cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI=
|
||||
cloud.google.com/go/longrunning v0.6.1 h1:lOLTFxYpr8hcRtcwWir5ITh1PAKUD/sG2lKrTSYjyMc=
|
||||
cloud.google.com/go/longrunning v0.6.1/go.mod h1:nHISoOZpBcmlwbJmiVk5oDRz0qG/ZxPynEGs1iZ79s0=
|
||||
cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI=
|
||||
cloud.google.com/go/managedidentities v1.5.0 h1:ZRQ4k21/jAhrHBVKl/AY7SjgzeJwG1iZa+mJ82P+VNg=
|
||||
cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA=
|
||||
cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak=
|
||||
@@ -756,25 +757,31 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19/go.mod h1:zminj5ucw7w0r65
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21 h1:AmoU1pziydclFT/xRV+xXE/Vb8fttJCLRPv8oAkprc0=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21/go.mod h1:AjUdLYe4Tgs6kpH4Bv7uMZo7pottoyHMn4eTcIcneaY=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22/go.mod h1:NtSFajXVVL8TA2QNngagVZmUtXciyrHOt7xgz4faS/M=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28/go.mod h1:EY3APf9MzygVhKuPXAc5H+MkGb8k/DOSQjWS0LgkKqI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2/go.mod h1:Za3IHqTQ+yNcRHxu1OFucBh0ACZT4j4VQFF0BqpZcLY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4/go.mod h1:4GQbF1vJzG60poZqWatZlhP31y8PGCCVTvIGPdaaYJ0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6 h1:50+XsN70RS7dwJ2CkVNXzj7U2L1HKP8nqTd3XWEXBN4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6/go.mod h1:WqgLmwY7so32kG01zD8CPTJWVWM+TzJoOVHwTg4aPug=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7/go.mod h1:kLPQvGUmxn/fqiCrDeohwG33bq2pQpGeY62yRO6Nrh0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13/go.mod h1:kizuDaLX37bG5WZaoxGPQR/LNFXpxp0vsUnqfkWXfNE=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.5/go.mod h1:wrMCEwjFPms+V86TCQQeOxQF/If4vT44FGIOFiMC2ck=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.7 h1:rLnYAfXQ3YAccocshIH5mzNNwZBkBo+bP6EhIxak6Hw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.7/go.mod h1:ZHtuQJ6t9A/+YDuxOLnbryAmITtr8UysSny3qcyvJTc=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8/go.mod h1:XDeGv1opzwm8ubxddF0cgqkZWsyOtw4lr6dxwmb6YQg=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.15/go.mod h1:2PCJYpi7EKeA5SkStAmZlF6fi0uUABuhtF8ILHjGc3Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4/go.mod h1:Tp/ly1cTjRLGBBmNccFumbZ8oqpZlpdhFf80SrRh4is=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6 h1:JnhTZR3PiYDNKlXy50/pNeix9aGMo6lLpXwJ1mw8MD4=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6/go.mod h1:URronUEGfXZN1VpdktPSD1EkAL9mfrV+2F4sjH38qOY=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7/go.mod h1:JfyQ0g2JG8+Krq0EuZNnRwX0mU0HrwY/tG6JNfcqh4k=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14/go.mod h1:RVwIw3y/IqxC2YEXSIkAzRDdEU1iRabDPaYjpGCbCGQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.32.4/go.mod h1:9XEUty5v5UAsMiFOBJrNibZgwCeOma73jgGwwhgffa8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.2 h1:s4074ZO1Hk8qv65GqNXqDjmkf4HSQqJukaLuuW0TpDA=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.2/go.mod h1:mVggCnIWoM09jP71Wh+ea7+5gAp53q+49wDFs1SW5z8=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3/go.mod h1:5Gn+d+VaaRgsjewpMvGazt0WfcFO+Md4wLOuBfGR9Bc=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.14/go.mod h1:dspXf/oYWGWo6DEvj98wpaTeqt5+DMidZD0A9BYTizc=
|
||||
github.com/bazelbuild/rules_go v0.49.0 h1:5vCbuvy8Q11g41lseGJDc5vxhDjJtfxr6nM/IC4VmqM=
|
||||
github.com/bazelbuild/rules_go v0.49.0/go.mod h1:Dhcz716Kqg1RHNWos+N6MlXNkjNP2EwZQ0LukRKJfMs=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
@@ -1981,6 +1988,7 @@ google.golang.org/genproto/googleapis/bytestream v0.0.0-20241021214115-324edc3d5
|
||||
google.golang.org/genproto/googleapis/bytestream v0.0.0-20241118233622-e639e219e697 h1:rY93Be8/KL+EtFM4im9lxMzjGn796GnwVUd75cyFCJg=
|
||||
google.golang.org/genproto/googleapis/bytestream v0.0.0-20241118233622-e639e219e697/go.mod h1:qUsLYwbwz5ostUWtuFuXPlHmSJodC5NI/88ZlHj4M1o=
|
||||
google.golang.org/genproto/googleapis/bytestream v0.0.0-20241209162323-e6fa225c2576/go.mod h1:qUsLYwbwz5ostUWtuFuXPlHmSJodC5NI/88ZlHj4M1o=
|
||||
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250127172529-29210b9bc287/go.mod h1:7VGktjvijnuhf2AobFqsoaBGnG8rImcxqoL+QPBPRq4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
|
||||
|
||||
@@ -28,7 +28,7 @@ func InsertDetails(client *mongo.Client, user, payMethod, amount, currency strin
|
||||
defer session.EndSession(context.Background())
|
||||
|
||||
// execute transaction
|
||||
result, err := session.WithTransaction(context.Background(), func(sessCtx mongo.SessionContext) (interface{}, error) {
|
||||
result, err := session.WithTransaction(context.Background(), func(_ mongo.SessionContext) (interface{}, error) {
|
||||
// perform an operation to insert data into paymentDetails in a transaction
|
||||
orderID, err := InsertPaymentDetails(client, user, payMethod, amount, currency, appID)
|
||||
if err != nil {
|
||||
@@ -44,7 +44,6 @@ func InsertDetails(client *mongo.Client, user, payMethod, amount, currency strin
|
||||
|
||||
return orderID, nil
|
||||
}, transactionOptions)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("transaction execution failure:", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user