From 2a2040c570187ca231381a573bf14edc4b6a71f4 Mon Sep 17 00:00:00 2001 From: Jo Date: Sun, 14 Aug 2022 17:41:54 +0000 Subject: [PATCH] chore: use stdlib vars in code (#1793) --- .golangci.yml | 1 + cmd.go | 2 +- pkg/news/news.go | 2 +- pkg/query/source_test.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 7919c27a..e20efb7c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,6 +38,7 @@ linters: disable-all: true enable: - bodyclose + - usestdlibvars - deadcode - depguard - dupl diff --git a/cmd.go b/cmd.go index b1e70fd6..fe95d55e 100644 --- a/cmd.go +++ b/cmd.go @@ -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) { - 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 { return err } diff --git a/pkg/news/news.go b/pkg/news/news.go index 3898ab53..f0768c72 100644 --- a/pkg/news/news.go +++ b/pkg/news/news.go @@ -61,7 +61,7 @@ type rss struct { } 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 { return err } diff --git a/pkg/query/source_test.go b/pkg/query/source_test.go index 152a9c72..330843a5 100644 --- a/pkg/query/source_test.go +++ b/pkg/query/source_test.go @@ -82,7 +82,7 @@ type mockDoer struct{} func (m *mockDoer) Do(req *http.Request) (*http.Response, error) { return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewBufferString(validPayload)), }, nil }