diff --git a/src/cmd/go/internal/web/url_other.go b/src/cmd/go/internal/web/url_other.go index 84bbd72820fcab..8f8cc7a99c9873 100644 --- a/src/cmd/go/internal/web/url_other.go +++ b/src/cmd/go/internal/web/url_other.go @@ -9,12 +9,11 @@ package web import ( "errors" "path/filepath" + "strings" ) func convertFileURLPath(host, path string) (string, error) { - switch host { - case "", "localhost": - default: + if host != "" && strings.EqualFold(host, "localhost") { return "", errors.New("file URL specifies non-local host") } return filepath.FromSlash(path), nil