1
0
Fork 0
mirror of https://github.com/laravel-ls/uri synced 2026-06-16 01:54:57 +02:00

Change variable in New() to a more meaningful name.

This commit is contained in:
Henrik Hautakoski 2025-06-20 09:48:17 +02:00
parent 6d2150a426
commit bd941efb04

20
uri.go
View file

@ -79,17 +79,17 @@ func filename(uri URI) (string, error) {
return u.Path, nil
}
// New parses and creates a new URI from s.
func New(s string) URI {
if u, err := url.PathUnescape(s); err == nil {
s = u
// New parses and creates a new URI from input.
func New(input string) URI {
if u, err := url.PathUnescape(input); err == nil {
input = u
}
if IsFileURI(s) {
return URI(s)
if IsFileURI(input) {
return URI(input)
}
return File(s)
return File(input)
}
// File parses and creates a new filesystem URI from path.
@ -118,9 +118,9 @@ func File(path string) URI {
return URI(u.String())
}
// Parse parses and creates a new URI from s.
func Parse(s string) (u URI, err error) {
us, err := url.Parse(s)
// Parse parses and creates a new URI from input.
func Parse(input string) (u URI, err error) {
us, err := url.Parse(input)
if err != nil {
return u, fmt.Errorf("url.Parse: %w", err)
}