Skip to content

Commit

Permalink
Enable usestdlibvars linter
Browse files Browse the repository at this point in the history
... and fix lints on the way.

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Nov 13, 2024
1 parent 2ae909e commit 08898de
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ run:

linters:
enable:
- 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
- revive # Stricter drop-in replacement for golint
- 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
- revive # Stricter drop-in replacement for golint
- 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 08898de

Please sign in to comment.