-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
What version of Go are you using (go version
)?
$ go version go version go1.19.3 darwin/arm64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/gnvk/Library/Caches/go-build" GOENV="/Users/gnvk/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/gnvk/Dev/go/pkg/mod" GONOPROXY="github.com/alpacahq/*" GONOSUMDB="github.com/alpacahq/*" GOOS="darwin" GOPATH="/Users/gnvk/Dev/go" GOPRIVATE="github.com/alpacahq/*" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/homebrew/opt/go/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.19.3" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/gnvk/Dev/alpaca/corpaca/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xv/5sz1kn411vb_g2_vmhnstl1c0000gn/T/go-build2211926623=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I ran the first example in the example under https://pkg.go.dev/time#Parse both in the Go Playground and on my local machine:
const longForm = "Jan 2, 2006 at 3:04pm (MST)"
t, _ := time.Parse(longForm, "Feb 3, 2013 at 7:54pm (PST)")
fmt.Println(t)
What did you expect to see?
2013-02-03 19:54:00 -0800 PST
What did you see instead?
2013-02-03 19:54:00 +0000 PST
https://github.com/golang/go/blob/master/src/time/example_test.go#L375 also seems to fail with this:
=== RUN ExampleParse
--- FAIL: ExampleParse (0.00s)
got:
2013-02-03 19:54:00 +0000 PST
2013-02-03 00:00:00 +0000 UTC
2006-01-02 15:04:05 +0000 UTC
2006-01-02 15:04:05 +0700 +0700
error parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"
want:
2013-02-03 19:54:00 -0800 PST
2013-02-03 00:00:00 +0000 UTC
2006-01-02 15:04:05 +0000 UTC
2006-01-02 15:04:05 +0700 +0700
error parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"
FAIL
Mark-Pintyelszamosi and Mark-Pintye