chore: use stdlib vars in code (#1793)

This commit is contained in:
Jo 2022-08-14 17:41:54 +00:00 committed by GitHub
parent 458c69e179
commit 2a2040c570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 3 deletions

View file

@ -38,6 +38,7 @@ linters:
disable-all: true disable-all: true
enable: enable:
- bodyclose - bodyclose
- usestdlibvars
- deadcode - deadcode
- depguard - depguard
- dupl - dupl

2
cmd.go
View file

@ -416,7 +416,7 @@ func syncList(ctx context.Context, httpClient *http.Client, cmdArgs *parser.Argu
} }
if config.Runtime.Mode.AtLeastAUR() && (len(cmdArgs.Targets) == 0 || aur) { if config.Runtime.Mode.AtLeastAUR() && (len(cmdArgs.Targets) == 0 || aur) {
req, err := http.NewRequestWithContext(ctx, "GET", config.AURURL+"/packages.gz", http.NoBody) req, err := http.NewRequestWithContext(ctx, http.MethodGet, config.AURURL+"/packages.gz", http.NoBody)
if err != nil { if err != nil {
return err return err
} }

View file

@ -61,7 +61,7 @@ type rss struct {
} }
func PrintNewsFeed(ctx context.Context, client *http.Client, cutOffDate time.Time, bottomUp, all, quiet bool) error { func PrintNewsFeed(ctx context.Context, client *http.Client, cutOffDate time.Time, bottomUp, all, quiet bool) error {
req, err := http.NewRequestWithContext(ctx, "GET", "https://archlinux.org/feeds/news", http.NoBody) req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://archlinux.org/feeds/news", http.NoBody)
if err != nil { if err != nil {
return err return err
} }

View file

@ -82,7 +82,7 @@ type mockDoer struct{}
func (m *mockDoer) Do(req *http.Request) (*http.Response, error) { func (m *mockDoer) Do(req *http.Request) (*http.Response, error) {
return &http.Response{ return &http.Response{
StatusCode: 200, StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewBufferString(validPayload)), Body: io.NopCloser(bytes.NewBufferString(validPayload)),
}, nil }, nil
} }