Skip to content

Commit

Permalink
chore: Enable G107 rule for gosec (influxdata#13010)
Browse files Browse the repository at this point in the history
Co-authored-by: Pawel Zak <Pawel Zak>
  • Loading branch information
zak-pawel authored Apr 3, 2023
1 parent 9bfe642 commit 0754247
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ linters-settings:
includes:
- G102
- G106
- G107
- G108
- G109
- G111
Expand Down
8 changes: 4 additions & 4 deletions tools/license_checker/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -93,5 +93,5 @@ func normalizeURL(raw string) (string, error) {
u.RawQuery = strings.Join(parts, ";")
}

return u.String(), nil
return u, nil
}

0 comments on commit 0754247

Please sign in to comment.