chore: Enable G107 rule for gosec (#13010)

Co-authored-by: Pawel Zak <Pawel Zak>
This commit is contained in:
Paweł Żak 2023-04-03 20:29:58 +02:00 committed by GitHub
parent 9bfe6425b3
commit 0754247d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -90,6 +90,7 @@ linters-settings:
includes:
- G102
- G106
- G107
- G108
- G109
- G111

View File

@ -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
}