Hello!
I'm trying to build statically linked binary and it works with 'build' command but failed with 'install' command. Here is an example:
go build -ldflags "-linkmode external -extldflags -static" -a swap.go
# file swap
swap: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=396a1f51971f4e0d44bfb489a84792efc1782e03, for GNU/Linux 3.2.0, with debug_info, not stripped
# ldd swap
not a dynamic executable
But following failed:
Following compiles but not as static:
# file ~/.go/bin/swap
/home/axet/.go/bin/swap: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=8DAAfOPcNpPhyRmJINiQ/RJu44gsWAPnCPTRsFMPn/vAto5mmPDQDM4aX1HuBe/7MY6v2L5JqkYe2MJN8uw, with debug_info, not stripped
# ldd ~/.go/bin/swap
not a dynamic executable
Bug or feature?