Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable usestdlibvars linter #5239

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading