fix: enable usestdlibvars linter (#7770)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2024-10-21 11:06:50 +02:00
committed by GitHub
parent 8d5dbc9fec
commit 57e24aa853
5 changed files with 8 additions and 5 deletions

View File

@@ -105,6 +105,7 @@ linters:
- typecheck
- unconvert
- unused
- usestdlibvars
run:
go: '1.22'

View File

@@ -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
}

View File

@@ -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)
}

View File

@@ -1,6 +1,7 @@
package apigateway
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
@@ -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),
},

View File

@@ -1,6 +1,7 @@
package apigateway
import (
"net/http"
"testing"
"github.com/aquasecurity/trivy/internal/testutil"
@@ -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),
},
@@ -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),
},