net/url: simplify values Get

This commit is contained in:
Mateusz Poliwczak 2023-02-23 16:54:43 +01:00
parent fb79da2991
commit 2578fd420e
1 changed files with 3 additions and 7 deletions

View File

@ -883,14 +883,10 @@ type Values map[string][]string
// the empty string. To access multiple values, use the map
// directly.
func (v Values) Get(key string) string {
if v == nil {
return ""
if vs := v[key]; len(vs) != 0 {
return vs[0]
}
vs := v[key]
if len(vs) == 0 {
return ""
}
return vs[0]
return ""
}
// Set sets the key to value. It replaces any existing