Skip to content

time: document behaviour of Parse in the presence of >9 fractional second digits #50806

@myitcv

Description

@myitcv

What version of Go are you using (go version)?

$ go version
go version devel go1.18-16d6a5233a Tue Jan 25 00:39:08 2022 +0000 linux/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="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/myitcv/gostuff/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="devel go1.18-16d6a5233a Tue Jan 25 00:39:08 2022 +0000"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3242720047=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go-review.googlesource.com/c/go/+/353713/ made a change to Parse() to truncate fractional seconds longer than 9 digits.

I defer to others on whether truncating, rounding or error-ing is the "right" answer here, but I think a doc update is in order whatever the conclusion. As was pointed out in #48685, certain such inputs resulted in an error prior to CL 353713, and some people might have been relying on that behaviour.

What did you expect to see?

https://pkg.go.dev/time@go1.18beta1 to mention of the behaviour when >9 fractional second digits are provided.

Such a change might also warrant a mention in the release notes, given the behaviour change.

What did you see instead?

As it stands https://pkg.go.dev/time@go1.18beta1 makes no mention.

CC @rsc via https://dev.golang.org/owners

CC @AlexanderYastrebov and @jtbandes from #48685

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions