]> Cypherpunks repositories - gostls13.git/commitdiff
net/url: simplify values Get
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Thu, 23 Feb 2023 19:03:00 +0000 (19:03 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 24 Feb 2023 12:38:08 +0000 (12:38 +0000)
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 <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

src/net/url/url.go

index d530a50d40d19fe2467e021308a808e009877d41..9ffd858a86632504ab4f9e28ccb62e7ac50e9e3d 100644 (file)
@@ -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 ""