From 2578fd420e7cb18d2af6a7a9d75f274a753dc26d Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Thu, 23 Feb 2023 16:54:43 +0100 Subject: [PATCH] net/url: simplify values Get --- src/net/url/url.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/net/url/url.go b/src/net/url/url.go index d530a50d40..182c4a99f6 100644 --- a/src/net/url/url.go +++ b/src/net/url/url.go @@ -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