1
0
Fork 0
mirror of https://github.com/laravel-ls/uri synced 2026-07-04 08:23:43 +02:00

uri: fix lint suggestion

This commit is contained in:
Koichi Shiraishi 2019-06-05 12:28:28 +09:00
parent 0e3caec80a
commit b45bca663f
No known key found for this signature in database
GPG key ID: A71DFD3B4DA7A79B

10
uri.go
View file

@ -246,7 +246,7 @@ func (u *URI) UnmarshalJSON(b []byte) error {
} }
// String implements fmt.Stringer. // String implements fmt.Stringer.
func (u URI) String() string { func (u *URI) String() string {
switch u.Scheme { switch u.Scheme {
case FileScheme, HTTPScheme, HTTPSScheme: case FileScheme, HTTPScheme, HTTPSScheme:
if u.skipEncoding { if u.skipEncoding {
@ -393,10 +393,8 @@ func encodeMinimal(path string, _ bool) string {
b.WriteString(path[0:i]) b.WriteString(path[0:i])
} }
b.WriteString(encodeTable[code]) b.WriteString(encodeTable[code])
} else { } else if b.String() != "" {
if b.String() != "" { b.WriteByte(path[i])
b.WriteByte(path[i])
}
} }
} }
@ -408,7 +406,7 @@ func encodeMinimal(path string, _ bool) string {
return res return res
} }
func format(uri URI, skipEncoding bool) string { func format(uri *URI, skipEncoding bool) string {
var encoder func(string, bool) string var encoder func(string, bool) string
switch skipEncoding { switch skipEncoding {
case true: case true: