From 827fd1b75d6a682c462209d47fc57dfb21ff5d66 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Fri, 27 Sep 2024 20:38:23 +0200 Subject: [PATCH 1/3] net: improve documentation of netgo and netcgo build tags Change-Id: Ifc240e08d92fc063276589eee17cd5d4b3f505f0 --- src/net/net.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/net/net.go b/src/net/net.go index f8b5834acba56a..2ef2290b913a29 100644 --- a/src/net/net.go +++ b/src/net/net.go @@ -68,6 +68,11 @@ GODEBUG environment variable (see package runtime) to go or cgo, as in: The decision can also be forced while building the Go source tree by setting the netgo or netcgo build tag. +The netgo build flag disables entirely the use of the native (CGO) resolver, so the +Go resolver is the only one that is supported, whereas with the netcgo build tag +the native and the pure Go resolver is compiled into the binary, but the native (CGO) +resolver is preferred over the Go resolver, no matter the system configuration. +The Go resolver can still be forced with GODEBUG=netdns=go or with the [Resolver.PreferGo] setting. A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver to print debugging information about its decisions. From de542f1b51e44a71e4258be5d5a5442c58da78cb Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Fri, 27 Sep 2024 20:43:58 +0200 Subject: [PATCH 2/3] update Change-Id: Idef626b47e7213a199c3e74ac43d61e9d5a9f8f5 --- src/net/net.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net/net.go b/src/net/net.go index 2ef2290b913a29..8bb4dd15551232 100644 --- a/src/net/net.go +++ b/src/net/net.go @@ -68,11 +68,11 @@ GODEBUG environment variable (see package runtime) to go or cgo, as in: The decision can also be forced while building the Go source tree by setting the netgo or netcgo build tag. -The netgo build flag disables entirely the use of the native (CGO) resolver, so the -Go resolver is the only one that is supported, whereas with the netcgo build tag -the native and the pure Go resolver is compiled into the binary, but the native (CGO) -resolver is preferred over the Go resolver, no matter the system configuration. -The Go resolver can still be forced with GODEBUG=netdns=go or with the [Resolver.PreferGo] setting. +The netgo build flag disables entirely the use of the native (CGO) resolver, +meaning the Go resolver is the only one that can be used. +With the netcgo build tag the native and the pure Go resolver are compiled into the binary, +but the native (CGO) resolver is preferred over the Go resolver, no matter the system configuration. +With netcgo, the Go resolver can still be forced at runtime with GODEBUG=netdns=go. A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver to print debugging information about its decisions. From b3853e9487da1006ecece9dd378e3de299d0b1da Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Fri, 27 Sep 2024 21:15:46 +0200 Subject: [PATCH 3/3] update Change-Id: I03983af1e27c0ee2b15683a62931314b480b51dd --- src/net/net.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/net.go b/src/net/net.go index 8bb4dd15551232..82dc222de1e75b 100644 --- a/src/net/net.go +++ b/src/net/net.go @@ -68,10 +68,10 @@ GODEBUG environment variable (see package runtime) to go or cgo, as in: The decision can also be forced while building the Go source tree by setting the netgo or netcgo build tag. -The netgo build flag disables entirely the use of the native (CGO) resolver, +The netgo build tag disables entirely the use of the native (CGO) resolver, meaning the Go resolver is the only one that can be used. With the netcgo build tag the native and the pure Go resolver are compiled into the binary, -but the native (CGO) resolver is preferred over the Go resolver, no matter the system configuration. +but the native (CGO) resolver is preferred over the Go resolver. With netcgo, the Go resolver can still be forced at runtime with GODEBUG=netdns=go. A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver