diff --git a/.golangci.yml b/.golangci.yml index e1854e9ef90a0..0e5b4164cd7c2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -90,6 +90,7 @@ linters-settings: includes: - G102 - G106 + - G107 - G108 - G109 - G111 diff --git a/tools/license_checker/package.go b/tools/license_checker/package.go index 7e41d0dfb8681..a7b4e1f62cda2 100644 --- a/tools/license_checker/package.go +++ b/tools/license_checker/package.go @@ -31,7 +31,7 @@ func (pkg *packageInfo) Classify() (float64, error) { } debugf("%q downloading from %q", pkg.name, source) - response, err := http.Get(source) + response, err := http.Get(source.String()) if err != nil { return 0.0, fmt.Errorf("download from %q failed: %w", source, err) } @@ -62,10 +62,10 @@ func (pkg *packageInfo) Classify() (float64, error) { return coverage.Percent, nil } -func normalizeURL(raw string) (string, error) { +func normalizeURL(raw string) (*url.URL, error) { u, err := url.Parse(raw) if err != nil { - return "", err + return nil, err } switch u.Hostname() { @@ -93,5 +93,5 @@ func normalizeURL(raw string) (string, error) { u.RawQuery = strings.Join(parts, ";") } - return u.String(), nil + return u, nil }