Skip to content

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

@quenbyako

Description

@quenbyako

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 🙃

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Linux

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions