Skip to content

Commit d514c42

Browse files
chore(deps): update all dependencies (#1333)
* chore(deps): update all dependencies * Fix all lint warnings after upgrading golangci-lint action Change-Id: I7b4162307ae0d6a1c9ec00b7127469c64ed93f64 Signed-off-by: Cosmin Cojocar <[email protected]> * Remove the backup file Signed-off-by: Cosmin Cojocar <[email protected]> --------- Signed-off-by: Cosmin Cojocar <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Cosmin Cojocar <[email protected]>
1 parent 1d458c5 commit d514c42

File tree

11 files changed

+95
-81
lines changed

11 files changed

+95
-81
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
restore-keys: |
2929
${{ runner.os }}-go-
3030
- name: lint
31-
uses: golangci/golangci-lint-action@v6
31+
uses: golangci/golangci-lint-action@v7
3232
with:
3333
version: ${{ matrix.version.golangci }}
3434
- name: Run Gosec Security Scanner

.golangci.yml

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
1+
version: "2"
12
linters:
23
enable:
34
- asciicheck
45
- bodyclose
56
- copyloopvar
67
- dogsled
78
- durationcheck
8-
- errcheck
99
- errorlint
10-
- gci
1110
- ginkgolinter
1211
- gochecknoinits
13-
- gofmt
14-
- gofumpt
15-
- goimports
1612
- gosec
17-
- gosimple
18-
- govet
1913
- importas
20-
- ineffassign
2114
- misspell
2215
- nakedret
2316
- nolintlint
2417
- revive
25-
- staticcheck
2618
- testifylint
27-
- typecheck
2819
- unconvert
2920
- unparam
30-
- unused
3121
- wastedassign
32-
33-
linters-settings:
34-
gci:
35-
sections:
36-
- standard
37-
- default
38-
- prefix(github.com/securego)
39-
staticcheck:
40-
checks:
41-
- all
42-
- '-SA1019'
43-
44-
testifylint:
45-
enable-all: true
46-
47-
revive:
48-
rules:
49-
- name: dot-imports
50-
disabled: true
51-
- name: redefines-builtin-id
52-
53-
run:
54-
timeout: 5m
22+
settings:
23+
revive:
24+
rules:
25+
- name: dot-imports
26+
disabled: true
27+
- name: redefines-builtin-id
28+
staticcheck:
29+
checks:
30+
- all
31+
- -SA1019
32+
testifylint:
33+
enable-all: true
34+
exclusions:
35+
generated: lax
36+
presets:
37+
- comments
38+
- common-false-positives
39+
- legacy
40+
- std-error-handling
41+
paths:
42+
- third_party$
43+
- builtin$
44+
- examples$
45+
formatters:
46+
enable:
47+
- gci
48+
- gofmt
49+
- gofumpt
50+
- goimports
51+
settings:
52+
gci:
53+
sections:
54+
- standard
55+
- default
56+
- prefix(github.com/securego)
57+
exclusions:
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

analyzer_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import (
2323

2424
. "github.com/onsi/ginkgo/v2"
2525
. "github.com/onsi/gomega"
26+
"golang.org/x/tools/go/packages"
27+
2628
"github.com/securego/gosec/v2"
2729
"github.com/securego/gosec/v2/analyzers"
2830
"github.com/securego/gosec/v2/rules"
2931
"github.com/securego/gosec/v2/testutils"
30-
"golang.org/x/tools/go/packages"
3132
)
3233

3334
var _ = Describe("Analyzer", func() {

autofix/ai.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func (w *genAIGenerativeModelWrapper) GenerateContent(ctx context.Context, promp
7676
}
7777

7878
// NewGenAIClient creates a new gemini API client.
79-
func NewGenAIClient(ctx context.Context, aiApiKey, endpoint string) (GenAIClient, error) {
80-
clientOptions := []option.ClientOption{option.WithAPIKey(aiApiKey)}
79+
func NewGenAIClient(ctx context.Context, aiAPIKey, endpoint string) (GenAIClient, error) {
80+
clientOptions := []option.ClientOption{option.WithAPIKey(aiAPIKey)}
8181
if endpoint != "" {
8282
clientOptions = append(clientOptions, option.WithEndpoint(endpoint))
8383
}
@@ -119,16 +119,16 @@ func generateSolutionByGemini(client GenAIClient, issues []*issue.Issue) error {
119119
}
120120

121121
// GenerateSolution generates a solution for the given issues using the specified AI provider
122-
func GenerateSolution(aiApiProvider, aiApiKey, endpoint string, issues []*issue.Issue) error {
122+
func GenerateSolution(aiAPIProvider, aiAPIKey, endpoint string, issues []*issue.Issue) error {
123123
ctx, cancel := context.WithTimeout(context.Background(), timeout)
124124
defer cancel()
125125

126126
var client GenAIClient
127127

128-
switch aiApiProvider {
128+
switch aiAPIProvider {
129129
case GeminiProvider:
130130
var err error
131-
client, err = NewGenAIClient(ctx, aiApiKey, endpoint)
131+
client, err = NewGenAIClient(ctx, aiAPIKey, endpoint)
132132
if err != nil {
133133
return fmt.Errorf("generating autofix: %w", err)
134134
}

cmd/gosec/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ USAGE:
6161
6262
`
6363
// Environment variable for AI API key.
64-
aiApiKeyEnv = "GOSEC_AI_API_KEY" // #nosec G101
64+
aiAPIKeyEnv = "GOSEC_AI_API_KEY" // #nosec G101
6565
)
6666

6767
type arrayFlags []string
@@ -154,10 +154,10 @@ var (
154154
flagTerse = flag.Bool("terse", false, "Shows only the results and summary")
155155

156156
// AI platform provider to generate solutions to issues
157-
flagAiApiProvider = flag.String("ai-api-provider", "", "AI API provider to generate auto fixes to issues.\nValid options are: gemini")
157+
flagAiAPIProvider = flag.String("ai-api-provider", "", "AI API provider to generate auto fixes to issues.\nValid options are: gemini")
158158

159159
// key to implementing AI provider services
160-
flagAiApiKey = flag.String("ai-api-key", "", "Key to access the AI API")
160+
flagAiAPIKey = flag.String("ai-api-key", "", "Key to access the AI API")
161161

162162
// endpoint to the AI provider
163163
flagAiEndpoint = flag.String("ai-endpoint", "", "Endpoint AI API.\nThis is optional, the default API endpoint will be used when not provided.")
@@ -504,12 +504,12 @@ func main() {
504504
reportInfo := gosec.NewReportInfo(issues, metrics, errors).WithVersion(Version)
505505

506506
// Call AI request to solve the issues
507-
aiApiKey := os.Getenv(aiApiKeyEnv)
508-
if aiApiKeyEnv == "" {
509-
aiApiKey = *flagAiApiKey
507+
aiAPIKey := os.Getenv(aiAPIKeyEnv)
508+
if aiAPIKeyEnv == "" {
509+
aiAPIKey = *flagAiAPIKey
510510
}
511-
if *flagAiApiProvider != "" && aiApiKey != "" {
512-
err := autofix.GenerateSolution(*flagAiApiProvider, aiApiKey, *flagAiEndpoint, issues)
511+
if *flagAiAPIProvider != "" && aiAPIKey != "" {
512+
err := autofix.GenerateSolution(*flagAiAPIProvider, aiAPIKey, *flagAiEndpoint, issues)
513513
if err != nil {
514514
logger.Print(err)
515515
}

cmd/tlsconfig/tlsconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func getGoCipherConfig(name string, sstls ServerSideTLSJson) (goCipherConfigurat
108108
cipherConf.MinVersion = fmt.Sprintf("0x%04x", versions[0])
109109
cipherConf.MaxVersion = fmt.Sprintf("0x%04x", versions[len(versions)-1])
110110
} else {
111-
return cipherConf, fmt.Errorf("No TLS versions found for configuration '%s'", name)
111+
return cipherConf, fmt.Errorf("no TLS versions found for configuration '%s'", name)
112112
}
113113
return cipherConf, nil
114114
}

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (c Config) WriteTo(w io.Writer) (int64, error) {
9595
func (c Config) Get(section string) (interface{}, error) {
9696
settings, found := c[section]
9797
if !found {
98-
return nil, fmt.Errorf("Section %s not in configuration", section)
98+
return nil, fmt.Errorf("section %s not in configuration", section)
9999
}
100100
return settings, nil
101101
}

go.mod

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ require (
77
github.com/gookit/color v1.5.4
88
github.com/lib/pq v1.10.9
99
github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5
10-
github.com/onsi/ginkgo/v2 v2.23.3
11-
github.com/onsi/gomega v1.36.3
10+
github.com/onsi/ginkgo/v2 v2.23.4
11+
github.com/onsi/gomega v1.37.0
1212
github.com/stretchr/testify v1.10.0
13-
golang.org/x/crypto v0.36.0
14-
golang.org/x/text v0.23.0
13+
golang.org/x/crypto v0.37.0
14+
golang.org/x/text v0.24.0
1515
golang.org/x/tools v0.31.0
1616
google.golang.org/api v0.228.0
1717
gopkg.in/yaml.v3 v3.0.1
@@ -30,7 +30,7 @@ require (
3030
github.com/go-logr/stdr v1.2.2 // indirect
3131
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3232
github.com/google/go-cmp v0.7.0 // indirect
33-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
33+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
3434
github.com/google/s2a-go v0.1.9 // indirect
3535
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
3636
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
@@ -43,11 +43,12 @@ require (
4343
go.opentelemetry.io/otel v1.34.0 // indirect
4444
go.opentelemetry.io/otel/metric v1.34.0 // indirect
4545
go.opentelemetry.io/otel/trace v1.34.0 // indirect
46+
go.uber.org/automaxprocs v1.6.0 // indirect
4647
golang.org/x/mod v0.24.0 // indirect
4748
golang.org/x/net v0.37.0 // indirect
4849
golang.org/x/oauth2 v0.28.0 // indirect
49-
golang.org/x/sync v0.12.0 // indirect
50-
golang.org/x/sys v0.31.0 // indirect
50+
golang.org/x/sync v0.13.0 // indirect
51+
golang.org/x/sys v0.32.0 // indirect
5152
golang.org/x/time v0.11.0 // indirect
5253
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
5354
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect

go.sum

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
179179
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
180180
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
181181
github.com/google/pprof v0.0.0-20200507031123-427632fa3b1c/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
182-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
183-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
182+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
183+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
184184
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
185185
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
186186
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
@@ -290,11 +290,11 @@ github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXW
290290
github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ=
291291
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
292292
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
293-
github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0=
294-
github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM=
293+
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
294+
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
295295
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
296-
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
297-
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
296+
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
297+
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
298298
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
299299
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
300300
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
@@ -304,6 +304,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
304304
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
305305
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
306306
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
307+
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
308+
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
307309
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
308310
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
309311
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
@@ -398,6 +400,8 @@ go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h
398400
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
399401
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
400402
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
403+
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
404+
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
401405
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
402406
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
403407
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
@@ -413,8 +417,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
413417
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
414418
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
415419
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
416-
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
417-
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
420+
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
421+
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
418422
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
419423
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
420424
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -498,8 +502,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
498502
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
499503
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
500504
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
501-
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
502-
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
505+
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
506+
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
503507
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
504508
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
505509
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -540,18 +544,18 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w
540544
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
541545
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
542546
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
543-
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
544-
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
547+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
548+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
545549
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
546-
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
547-
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
550+
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
551+
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
548552
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
549553
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
550554
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
551555
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
552556
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
553-
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
554-
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
557+
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
558+
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
555559
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
556560
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
557561
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

helpers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,23 @@ func GetInt(n ast.Node) (int64, error) {
8383
if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.INT {
8484
return strconv.ParseInt(node.Value, 0, 64)
8585
}
86-
return 0, fmt.Errorf("Unexpected AST node type: %T", n)
86+
return 0, fmt.Errorf("unexpected AST node type: %T", n)
8787
}
8888

8989
// GetFloat will read and return a float value from an ast.BasicLit
9090
func GetFloat(n ast.Node) (float64, error) {
9191
if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.FLOAT {
9292
return strconv.ParseFloat(node.Value, 64)
9393
}
94-
return 0.0, fmt.Errorf("Unexpected AST node type: %T", n)
94+
return 0.0, fmt.Errorf("unexpected AST node type: %T", n)
9595
}
9696

9797
// GetChar will read and return a char value from an ast.BasicLit
9898
func GetChar(n ast.Node) (byte, error) {
9999
if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.CHAR {
100100
return node.Value[0], nil
101101
}
102-
return 0, fmt.Errorf("Unexpected AST node type: %T", n)
102+
return 0, fmt.Errorf("unexpected AST node type: %T", n)
103103
}
104104

105105
// GetStringRecursive will recursively walk down a tree of *ast.BinaryExpr. It will then concat the results, and return.
@@ -142,7 +142,7 @@ func GetString(n ast.Node) (string, error) {
142142
return strconv.Unquote(node.Value)
143143
}
144144

145-
return "", fmt.Errorf("Unexpected AST node type: %T", n)
145+
return "", fmt.Errorf("unexpected AST node type: %T", n)
146146
}
147147

148148
// GetCallObject returns the object and call expression and associated

report/formatter_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ func createReportInfo(rule string, weakness *cwe.Weakness) gosec.ReportInfo {
5151
}
5252

5353
func stripString(str string) string {
54-
ret := strings.Replace(str, "\n", "", -1)
55-
ret = strings.Replace(ret, " ", "", -1)
56-
ret = strings.Replace(ret, "\t", "", -1)
54+
ret := strings.ReplaceAll(str, "\n", "")
55+
ret = strings.ReplaceAll(ret, " ", "")
56+
ret = strings.ReplaceAll(ret, "\t", "")
5757
return ret
5858
}
5959

0 commit comments

Comments
 (0)