Closed as duplicate of#9346
Closed as duplicate of#9346
Description
Go version
go version go1.21.6 darwin/arm64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/kuknitin/Library/Caches/go-build'
GOENV='/Users/kuknitin/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/kuknitin/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/kuknitin/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.6/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.6/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/tp/8gddycn174j124g7lkl42trh0000gn/T/go-build1722890158=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
Used the provided example for RFC3339 time layout (https://github.com/golang/go/blob/master/src/time/format.go#L119) , and tried to parse it via time.Parse
Go code
// Output is
// parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"
package main
import (
"fmt"
"time"
)
func main() {
str_to_parse := time.RFC3339
t,err := time.Parse(time.RFC3339, str_to_parse)
if err!=nil {
fmt.Println(err)
} else {
fmt.Println("Parse done : ", t)
}
}
What did you see happen?
(.venv) ➜ ~/Workspace/kuknitin/shared/Misc/Go git:(main) ✗ [3:38:43] go run Learning/misc/time/rfc3339_bug.go
parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"
(.venv) ➜ ~/Workspace/kuknitin/shared/Misc/Go git:(main) ✗ [3:40:00]
What did you expect to see?
Correct output with parse done.
Metadata
Metadata
Assignees
Labels
No labels