lib/logger: explicitly import "time/tzdata" package for embedding tzdata into the app

The approach with `timetzdata` build tag didn't work for GOARCH=arm and GOARCH=ppc64le
due to the issue https://github.com/golang/go/issues/44073#issuecomment-778854298
This commit is contained in:
Aliaksandr Valialkin 2021-02-15 00:50:06 +02:00
parent 71c417427c
commit 74963f71c6
2 changed files with 10 additions and 1 deletions

View file

@ -34,7 +34,7 @@ app-via-docker: package-builder
$(BUILDER_IMAGE) \
go build $(RACE) -mod=vendor -trimpath \
-ldflags "-extldflags '-static' $(GO_BUILDINFO)" \
-tags 'netgo osusergo nethttpomithttp2 timetzdata' \
-tags 'netgo osusergo nethttpomithttp2' \
-o bin/$(APP_NAME)$(APP_SUFFIX)-prod $(PKG_PREFIX)/app/$(APP_NAME)
package-via-docker: package-base

9
lib/logger/tzdata.go Normal file
View file

@ -0,0 +1,9 @@
// +build go1.15
package logger
import (
// This is needed for embedding tzdata into binary, so `-loggerTimezone` could work in an app running on a scratch base Docker image.
// The "time/tzdata" package has been appeared starting from Go1.15 - see https://golang.org/doc/go1.15#time/tzdata
_ "time/tzdata"
)