To create a clean statically linked binary, still need to compile with -tags netgo in Go 1.5+?

I am trying to create a clean statically linked binary to run in a minimal Docker container. Before Go 1.5, I built them like this:

go build -a -tags netgo -installsuffix netgo myfile.go

I understand that C was excluded from the Go compiler in version 1.5. Do I need to build with -tagsand -installsuffix?

+4
source share
1 answer

https://golang.org/doc/go1.5#net

DNS- cgo . Go 1.5 , Unix- DNS- cgo, . , , Go. , DNS , , DNS- .

, , , . netgo, Go resolver , . Netcgo build tag cgo resolver . cgo GODEBUG = netdns = cgo . .

Unix. Windows, Mac OS X 9 .

.

+8

Source: https://habr.com/ru/post/1606087/


All Articles