Skip to content

Commit

Permalink
fix: enable usestdlibvars linter (#7770)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 authored Oct 21, 2024
1 parent 8d5dbc9 commit 57e24aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ linters:
- typecheck
- unconvert
- unused
- usestdlibvars

run:
go: '1.22'
Expand Down
2 changes: 1 addition & 1 deletion integration/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func requestRegistryToken(imageRef name.Reference, baseDir string, opt registryO
}

// Get a registry token
req, err := http.NewRequest("GET", fmt.Sprintf("%s/auth", opt.AuthURL), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/auth", opt.AuthURL), nil)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dependency/parser/java/pom/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func (p *Parser) remoteRepoRequest(repo string, paths []string) (*http.Request,
paths = append([]string{repoURL.Path}, paths...)
repoURL.Path = path.Join(paths...)

req, err := http.NewRequest("GET", repoURL.String(), http.NoBody)
req, err := http.NewRequest(http.MethodGet, repoURL.String(), http.NoBody)
if err != nil {
return nil, xerrors.Errorf("unable to create HTTP request: %w", err)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/iac/adapters/terraform/aws/apigateway/adapt_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package apigateway

import (
"net/http"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -72,7 +73,7 @@ resource "aws_apigatewayv2_domain_name" "example" {
{
Methods: []v1.Method{
{
HTTPMethod: String("GET"),
HTTPMethod: String(http.MethodGet),
AuthorizationType: String("NONE"),
APIKeyRequired: Bool(false),
},
Expand Down
5 changes: 3 additions & 2 deletions pkg/iac/adapters/terraform/aws/apigateway/apiv1_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package apigateway

import (
"net/http"
"testing"

"github.com/aquasecurity/trivy/internal/testutil"
Expand Down Expand Up @@ -35,7 +36,7 @@ resource "aws_api_gateway_method" "example" {
`,
expected: []v1.Method{
{
HTTPMethod: String("GET"),
HTTPMethod: String(http.MethodGet),
AuthorizationType: String("NONE"),
APIKeyRequired: Bool(false),
},
Expand Down Expand Up @@ -63,7 +64,7 @@ resource "aws_api_gateway_method" "example" {
`,
expected: []v1.Method{
{
HTTPMethod: String("GET"),
HTTPMethod: String(http.MethodGet),
AuthorizationType: String("NONE"),
APIKeyRequired: Bool(true),
},
Expand Down

0 comments on commit 57e24aa

Please sign in to comment.