From ebd652c4f443dcb70d01355980a15e81b977a940 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 9 Mar 2020 14:41:18 +0200 Subject: [PATCH] Revert "Add error check to time-parsing" This reverts commit 904c01a09867b3253517e1543fe58796de473634. --- .../time-formatting-parsing.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/examples/time-formatting-parsing/time-formatting-parsing.go b/examples/time-formatting-parsing/time-formatting-parsing.go index 34da49b..2968c3c 100644 --- a/examples/time-formatting-parsing/time-formatting-parsing.go +++ b/examples/time-formatting-parsing/time-formatting-parsing.go @@ -18,12 +18,9 @@ func main() { p(t.Format(time.RFC3339)) // Time parsing uses the same layout values as `Format`. - t1, err := time.Parse( + t1, e := time.Parse( time.RFC3339, "2012-11-01T22:08:41+00:00") - if err != nil { - panic(err) - } p(t1) // `Format` and `Parse` use example-based layouts. Usually @@ -37,10 +34,7 @@ func main() { p(t.Format("Mon Jan _2 15:04:05 2006")) p(t.Format("2006-01-02T15:04:05.999999-07:00")) form := "3 04 PM" - t2, err := time.Parse(form, "8 41 PM") - if err != nil { - panic(err) - } + t2, e := time.Parse(form, "8 41 PM") p(t2) // For purely numeric representations you can also @@ -53,6 +47,6 @@ func main() { // `Parse` will return an error on malformed input // explaining the parsing problem. ansic := "Mon Jan _2 15:04:05 2006" - _, e := time.Parse(ansic, "8:41PM") + _, e = time.Parse(ansic, "8:41PM") p(e) }