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

time: LoadLocation doesn't work on Linux if tzdata dependency not installed #38013

Closed
quenbyako opened this issue Mar 22, 2020 · 8 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Linux
Milestone

Comments

@quenbyako
Copy link

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

go version go1.12.7 linux/amd64

Does this issue reproduce with the latest release?

Yeup, on all go versions

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

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ololosha228/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ololosha228/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build504687575=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Absolutely same thing as in #21881 (code example). Problem is that zoneinfo is so large for packing it in binary file (800kb). But: as on windows, zone info package is not required for any Linux distro.

How did i found this issue: when you packing your go binary even with -ldflags '-d -s -w' (static build for non-libc distros), using time.LoadLocation() always require tzdata dependency. This is awful, when you trying to pack your app in docker images without package manager (busybox, custom enterprise images). That's bad behavior.

Actually, same problem is with net/http, when you try to connect using tls/ssl. but with https problem is explainable: ssl certificates updates often.

What did you expect to see?

Working example on pure linux system. Basically i expect to see way to manage this issue.

What did you see instead?

Program doesn't working 🙃

@ianlancetaylor
Copy link
Contributor

I've filed #38017 as a proposal for a time/tzdata package. Please comment or emoji vote there about this idea. Thanks.

@gopherbot
Copy link

Change https://golang.org/cl/224588 mentions this issue: time/tzdata: new package

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 23, 2020
@andybons andybons added this to the Unplanned milestone Mar 23, 2020
@leighmcculloch
Copy link
Contributor

Does anyone know how non-Go problems address this issue on Linux distributions?

@quenbyako
Copy link
Author

quenbyako commented Mar 25, 2020

@leighmcculloch it IS go problem, cause time package forcely load data from constant directory path, and you can't change it. This issue not about go as language, but go as stdlib.

So, yes, this problem is related to go as it could be.

@quenbyako
Copy link
Author

@andybons could you please add ExpertNeeded and OS-Linux labels to this issue?

@ianlancetaylor
Copy link
Contributor

@ololosha228 That doesn't really answer @leighmcculloch 's question, though. It seems like a good question to me.

I'll add the OS-Linux label but I'm not clear on why this is ExpertNeeded.

@dmitshur
Copy link
Contributor

Re-opening as CL 224588 was rolled back in CL 228200.

@dmitshur dmitshur reopened this Apr 13, 2020
@gopherbot
Copy link

Change https://golang.org/cl/228101 mentions this issue: time/tzdata: new package

@golang golang locked and limited conversation to collaborators Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Linux
Projects
None yet
Development

No branches or pull requests

6 participants