Go relies on the operating system for timezone data, so when you do time.LoadLocation("America/Guayaquil"), it runs code that's different in different OSes. If you use a Docker container to run your code, it's possible to include this data in the form of a .zip file.

Here's how to do this:

  1. Get the zoneinfo.zip file from the Go directory, located in $GOROOT/lib/time/zoneinfo.zip.

  2. In your Dockerfile, add these lines: (this assumes the .zip file is on the same directory)

    ADD zoneinfo.zip /zoneinfo.zip
    ENV ZONEINFO /zoneinfo.zip
  3. Go will read the environment variable and use the file. There's no step 3.

Previous on Go