Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html/template: Since 2024, if on Zero value date is true #64948

Closed
dstpierre opened this issue Jan 3, 2024 · 1 comment
Closed

html/template: Since 2024, if on Zero value date is true #64948

dstpierre opened this issue Jan 3, 2024 · 1 comment

Comments

@dstpierre
Copy link

Go version

go version go1.21.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/dstpierre/.cache/go-build'
GOENV='/home/dstpierre/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/dstpierre/.asdf/installs/golang/1.21.4/packages/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/dstpierre/.asdf/installs/golang/1.21.4/packages'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/dstpierre/.asdf/installs/golang/1.21.4/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/dstpierre/.asdf/installs/golang/1.21.4/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/dstpierre/src/fc/qlix/go.mod'
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build384955155=/tmp/go-build -gno-record-gcc-switches'

What did you do?

There's a program in production for 5 years on 2 servers. There has been no update to the code and no update to the server.

Prior to 2024, an {{if .XYZ}} where XYZ is a zero value time.Time would return false. Since 2024, all if in templates are entering the true condition and not the else.

Here's how to reproduce: https://go.dev/play/p/EnZo6Wicr8y

What did you expect to see?

Zero value time.Time were entering the {{else}} branch before 2024.

What did you see instead?

Now, a zero value time.Time enters the true branch of {{if}}

@seankhliao
Copy link
Member

it's been like this since forever (at least 1.11, the earliest one i've bothered to check)

closing as working as intended.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants