3 ms·
It should be noted Go hasn't spit out static executables by default for at least 5 years now (if not longer), and if you want static executables from Go it requ
by cyphar 4y ago
It should be noted Go hasn't spit out static executables by default for at least 5 years now (if not longer), and if you want static executables from Go it requires several arcane incantations (not unlike getting a static binary from GCC).
Basically every Go executable is dynamically linked against libc these days unless the builder goes seriously out of their way to get a static binary.
- pekim 4y agoI'm not sure that's true. $ go version go version go1.18.3 linux/amd64 $ cat static.go package main import "fmt" func main() { fmt.Println("static") } $ go build static.go $ file static static: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=TSoFKMWZzy5G6qyFvxx5/dwEbvdQns9f-iffR-lbW/iTmqy3UF8tbT-GGwVH61/lUZUt7_XebTifpVvE_52, not stripped $ ldd static not a dynamic executable But it might not be the case for all systems. And some things, like using CGO or performing DNS lookups, will necessitate dynamic linking.