Skip to content

Commit 57e24aa

Browse files
authored
fix: enable usestdlibvars linter (#7770)
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 8d5dbc9 commit 57e24aa

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ linters:
105105
- typecheck
106106
- unconvert
107107
- unused
108+
- usestdlibvars
108109

109110
run:
110111
go: '1.22'

integration/registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func requestRegistryToken(imageRef name.Reference, baseDir string, opt registryO
334334
}
335335

336336
// Get a registry token
337-
req, err := http.NewRequest("GET", fmt.Sprintf("%s/auth", opt.AuthURL), nil)
337+
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/auth", opt.AuthURL), nil)
338338
if err != nil {
339339
return "", err
340340
}

pkg/dependency/parser/java/pom/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ func (p *Parser) remoteRepoRequest(repo string, paths []string) (*http.Request,
703703
paths = append([]string{repoURL.Path}, paths...)
704704
repoURL.Path = path.Join(paths...)
705705

706-
req, err := http.NewRequest("GET", repoURL.String(), http.NoBody)
706+
req, err := http.NewRequest(http.MethodGet, repoURL.String(), http.NoBody)
707707
if err != nil {
708708
return nil, xerrors.Errorf("unable to create HTTP request: %w", err)
709709
}

pkg/iac/adapters/terraform/aws/apigateway/adapt_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package apigateway
22

33
import (
4+
"net/http"
45
"testing"
56

67
"github.com/stretchr/testify/assert"
@@ -72,7 +73,7 @@ resource "aws_apigatewayv2_domain_name" "example" {
7273
{
7374
Methods: []v1.Method{
7475
{
75-
HTTPMethod: String("GET"),
76+
HTTPMethod: String(http.MethodGet),
7677
AuthorizationType: String("NONE"),
7778
APIKeyRequired: Bool(false),
7879
},

pkg/iac/adapters/terraform/aws/apigateway/apiv1_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package apigateway
22

33
import (
4+
"net/http"
45
"testing"
56

67
"github.com/aquasecurity/trivy/internal/testutil"
@@ -35,7 +36,7 @@ resource "aws_api_gateway_method" "example" {
3536
`,
3637
expected: []v1.Method{
3738
{
38-
HTTPMethod: String("GET"),
39+
HTTPMethod: String(http.MethodGet),
3940
AuthorizationType: String("NONE"),
4041
APIKeyRequired: Bool(false),
4142
},
@@ -63,7 +64,7 @@ resource "aws_api_gateway_method" "example" {
6364
`,
6465
expected: []v1.Method{
6566
{
66-
HTTPMethod: String("GET"),
67+
HTTPMethod: String(http.MethodGet),
6768
AuthorizationType: String("NONE"),
6869
APIKeyRequired: Bool(true),
6970
},

0 commit comments

Comments
 (0)