Go: zoneinfo.zip wrong path update in build

#1

On Jan 25th I entered this bug report


Go: update path to zoneinfo.zip

but I didn’t get any updates on it so I thought I should bring it up here (I hope this is the right place).

The summary is that a go program that uses timezone information, compiled using nix-shell, cannot run on a different server.

Why?
Because the go nix package updates the go source code (not my program, but the language itself) and replaces the path

"/usr/share/zoneinfo/",

with

/nix/store/bgzqg5q8q1gpsbmpy4mavvnjzy528c8l-tzdata-2018g/share/zoneinfo/

But my servers don’t have the nix path, they have the default /usr/share/zoneinfo path (Ubuntu and prob others use the same).

The ticket has more details and I’m happy to paste them here is that is better.

Thanks

Diego

0 Likes

#2

Possibly relevant: Building an executable with Nix that can run on Ubuntu 16.04

0 Likes

#3

How do you deploy your application? Binaries built with Nix should be also deployed with Nix, not just copied around.

Read about things like:

0 Likes

#4

There could be a disconnect between how Go developers are used to working with and the Nix way of doing things. But Go application are meant to be simply copied around. The Go language and tools let you even compile, on a Linux machine, a binary that will run on Windows or Mac, without having to get any special compiler or VM on the target/build machine.

And regarding the particular ticket I entered, right now when nix installs the Go language, it changes “one” of the path where the language looks for timezone data, and replaces it with the nix one, but leaves a few others. That is why I thought it would be great if instead of picking that one entry and replace it, nix would prepend the nix path, so a 100% Nix shop runs fine, but those of us who have a mixed environment can also work ok without having to bring in a lot of extra files/use other modules.

Thanks.

Diego

0 Likes