From b87c8c3523010be38c53e0c82e58016202be6a0d Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Thu, 23 Feb 2023 19:03:00 +0000 Subject: [PATCH] net/url: simplify values Get Checking if v == nil is unnecessary, nil map always return the zero value of the value type. Change-Id: I9c5499bc7db72c4c62e02013ba7f9a6ee4795c09 GitHub-Last-Rev: 03fc2330e2ae568eafeb4d2e25e3f3535491062a GitHub-Pull-Request: golang/go#58662 Reviewed-on: https://go-review.googlesource.com/c/go/+/470736 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Than McIntosh Run-TryBot: Ian Lance Taylor --- src/net/url/url.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/net/url/url.go b/src/net/url/url.go index d530a50d40..9ffd858a86 100644 --- a/src/net/url/url.go +++ b/src/net/url/url.go @@ -883,9 +883,6 @@ 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 "" - } vs := v[key] if len(vs) == 0 { return "" -- 2.50.0