]> Cypherpunks repositories - gostls13.git/commitdiff
time: don't check non-nil err twice in parse
authorTobias Klauser <tklauser@distanz.ch>
Tue, 10 Sep 2024 10:47:22 +0000 (12:47 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 10 Sep 2024 21:43:25 +0000 (21:43 +0000)
Change-Id: I40a1b49035321b05032eacf4525a62b8c562e0d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/612195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/time/format.go

index cab78f73a06fc8eb644c596061e875f17e2ad38c..b9cd702c0db3e7c5d9dd04ae4d3c85e2f8bc36da 100644 (file)
@@ -1259,9 +1259,9 @@ func parse(layout, value string, defaultLocation, local *Location) (Time, error)
                        hr, _, err = getnum(hour, true)
                        if err == nil {
                                mm, _, err = getnum(min, true)
-                       }
-                       if err == nil {
-                               ss, _, err = getnum(seconds, true)
+                               if err == nil {
+                                       ss, _, err = getnum(seconds, true)
+                               }
                        }
 
                        // The range test use > rather than >=,