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
ololosha228 opened this issue Mar 22, 2020 · 8 comments
Closed

Comments

@ololosha228
Copy link

@ololosha228 ololosha228 commented Mar 22, 2020

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

@ianlancetaylor ianlancetaylor commented Mar 23, 2020

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

@gopherbot gopherbot commented Mar 23, 2020

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

@andybons andybons added this to the Unplanned milestone Mar 23, 2020
@leighmcculloch
Copy link
Contributor

@leighmcculloch leighmcculloch commented Mar 24, 2020

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

@ololosha228
Copy link
Author

@ololosha228 ololosha228 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.

@ololosha228
Copy link
Author

@ololosha228 ololosha228 commented Mar 25, 2020

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

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 25, 2020

@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
Member

@dmitshur dmitshur commented Apr 13, 2020

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

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

@gopherbot gopherbot commented Apr 13, 2020

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

@gopherbot gopherbot closed this in ab31e27 Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.