The string format used is `"2006-01-02 15:04:05.999999999 -0700 MST"` which is `time.String()` internal format
On Wednesday, 9 November 2022 at 18:48:09 UTC+2 Ian Lance Taylor wrote: > On Wed, Nov 9, 2022 at 8:33 AM Erez Rokah <er...@cloudquery.io> wrote: > > > > I'm not sure if this is a bug or not. The following test will print both > error messages: > > > > ``` > > func TestTimeStringParse(t *testing.T) { > > for i := 0; i < 100000; i++ { > > timeString := time.Now().Add(time.Duration(rand.Int63())).String() > > _, err := time.Parse(defaultStringFormat, timeString) > > if err == nil { > > t.Errorf("time.Parse(%q) should return error", timeString) > > } else { > > t.Errorf("time.Parse(%q) should not return error", timeString) > > } > > } > > } > > ``` > > > > The failure stems from Go 1.19 adding the extra text `m=+<int>` for the > monotonic clock. > > This doesn't happen for every `time.String()` invocation, which is a bit > confusing. > > I understand one shouldn't try to parse `time.String()`, especially with > the private format, however this does looks like something that worked > before Go 1.19. > > > > Would be glad to know what others think. > > > What is defaultStringFormat? > > Adding m=<int> is not new in Go 1.19. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/bc51019f-9794-41eb-8a86-96234bc1ea11n%40googlegroups.com.