Skip to content

Commit

Permalink
Merge pull request #5239 from twz123/usestdlibvars
Browse files Browse the repository at this point in the history
Enable usestdlibvars linter
  • Loading branch information
twz123 authored Nov 14, 2024
2 parents fa78301 + 55f415b commit 15586ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
21 changes: 11 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ run:

linters:
enable:
- copyloopvar # Detects unnecessary copies of loop variables for Go >= 1.22
- depguard # Checks if package imports are in a list of acceptable packages
- dupword # Finds word repetitions
- errorlint # Find code that will cause problems with Go's error wrapping scheme
- gofmt # Checks whether code was gofmt-ed
- goheader # Checks is file headers matche a given pattern
- intrange # Checking for loops that could use an integer range
- revive # Stricter drop-in replacement for golint
- testifylint # Checks usage of github.com/stretchr/testify
- unconvert # Checks for unnecessary type conversions
- copyloopvar # Detects unnecessary copies of loop variables for Go >= 1.22
- depguard # Checks if package imports are in a list of acceptable packages
- dupword # Finds word repetitions
- errorlint # Find code that will cause problems with Go's error wrapping scheme
- gofmt # Checks whether code was gofmt-ed
- goheader # Checks is file headers matche a given pattern
- intrange # Checking for loops that could use an integer range
- revive # Stricter drop-in replacement for golint
- testifylint # Checks usage of github.com/stretchr/testify
- unconvert # Checks for unnecessary type conversions
- usestdlibvars # Checks for things that are provided by the standard library

linters-settings:
depguard:
Expand Down
2 changes: 1 addition & 1 deletion internal/http/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Download(ctx context.Context, url string, target io.Writer, options ...Down

// Prepare the client and the request.
client := http.Client{Transport: transport}
req, err := http.NewRequest("GET", url, nil)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return fmt.Errorf("invalid download request: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/autopilot/channels/channelclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *ChannelClient) GetLatest(ctx context.Context, headers map[string]string

var v VersionInfo

req, err := http.NewRequestWithContext(ctx, "GET", c.channelURL, nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.channelURL, nil)
if err != nil {
return v, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/worker/static_pods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func TestStaticPods_Lifecycle(t *testing.T) {
url, err := underTest.ManifestURL()
require.NoError(t, err)

req, err := http.NewRequest("GET", url, nil)
req, err := http.NewRequest(http.MethodGet, url, nil)
require.NoError(t, err)

ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
Expand Down

0 comments on commit 15586ee

Please sign in to comment.