Skip to content

Commit

Permalink
Update manifest.go
Browse files Browse the repository at this point in the history
Address PR comments:
* Do not return bool, err on isValidURL
* Do not wrap error for the sake of wrapping the error.

Co-authored-by: Philip Potter <[email protected]>
  • Loading branch information
tempusfrangit and philandstuff committed Feb 21, 2024
1 parent 74d8b80 commit b95096b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/multifile/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func parseManifest(file io.Reader) (pget.Manifest, error) {
return nil, err
}
}
if valid, err := validURL(urlString); !valid {
return nil, fmt.Errorf("error parsing manifest invalid URL: %s: %w", urlString, err)
if err := validURL(urlString); err != nil {
return nil, err

}
manifest = manifest.AddEntry(urlString, dest)
Expand All @@ -114,7 +114,7 @@ func parseManifest(file io.Reader) (pget.Manifest, error) {
return manifest, nil
}

func validURL(s string) (bool, error) {
func validURL(s string) error {
_, err := netUrl.Parse(s)
return err == nil, err
return err
}

0 comments on commit b95096b

Please sign in to comment.