You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's always been true that the Go tool sometimes generates a dynamically linked binary. Is the behavior on your program different than that of 1.11?
In particular, by default, if your program depends on the net or os/user packages, by default you will get a dynamically linked binary. To avoid that, build with -tags "netgo osusergo".
Go 1.11 also generates a dynamically linked binary. I thought Go always built statically linked binaries. It's a selling feature (you only have to copy the binary to deploy...) Doing a presentation at Oracle Applications Users Group about Go in April. Will need to add the caveat.
The problem with the net and os/user packages is that accessing DNS and LDAP data in the exact same way as the local system is in general a very difficult problem. So by default we fall back to the OS support, while providing the netgo and osusergo tags for people who know what they are doing.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
$ ls -lrt
total 0
-rw-rw-r-- 1 jkayser jkayser 82 Feb 18 14:22 hello.go
-rw-rw-r-- 1 jkayser jkayser 239 Feb 18 14:57 server.go
$ go build hello.go
$ go build server.go
$ file *
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
hello.go: C source, ASCII text
server: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
server.go: C source, ASCII text
$
hello.go: https://play.golang.org/p/ueti2wwyW3N
server.go: https://play.golang.org/p/RzImKo9Men5
What did you expect to see?
All binaries generated by Go to be statically linked.
What did you see instead?
One binary dynamically linked.
The text was updated successfully, but these errors were encountered: