I don't think I'm the only one that might be confused by this.
I have a very simple Go Program, the only dependencies are.
import (
"fmt"
"time"
)
I used "go build myprogram.go" , and get a binary that runs fine (since I have GO installed)
However, if someone else does not have GO installed they seem to get errors.
For Example:
open c:\go\lib\time\zoneinfo.zip: The system cannot find the path specified.
panic: time: missing Location in call to Time.In
What do I need to do to include third party libraries in the build ?
I'd like to generate a Binary that will run on any Platform without worrying about dependencies
Without a fuller example of your code, it's hard to answer the specific issue, but what I do to generate standalone binaries is:
CGO_ENABLED=0 go build -v -a -ldflags '-s -w' ./...
Which builds a static binary without libc dependencies at least... It seems the zoneinfo.zip dependency wouldn't be covered by that.
The zoneinfo.zip file is not unique to Go... Go expects it to be installed on the system. Here is the code that scans system folders for that file: https://golang.org/src/time/zoneinfo_unix.go#L31
At time of writing:
var zoneDirs = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}