From 0bf757159d13dd18815e0c1926ed73999b2ec458 Mon Sep 17 00:00:00 2001 From: Rens Rikkerink Date: Fri, 23 Feb 2018 16:25:48 +0100 Subject: [PATCH] cmd/cgo: applied alternative wording to cgo constraint A change suggested by @ianlancetaylor on gerrit, provides a more direct and clear message for the documentation. --- src/cmd/cgo/doc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 5774a64e9a..830ee9b4f0 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -109,9 +109,11 @@ it is expected to work. It is disabled by default when cross-compiling. You can control this by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it. The go tool will set the -build constraint "cgo" if cgo is enabled. When the Go tool sees the -special import "C", the "cgo" build constraint will be implied, causing -the tool to skip the file if CGO_ENABLED is set to 0. +build constraint "cgo" if cgo is enabled. The special import "C" +implies the "cgo" build constraint, as though the file also said +"// +build cgo". Therefore, if cgo is disabled, files that import +"C" will not be built by the go tool. +(For more about build constraints see https://golang.org/pkg/go/build/#hdr-Build_Constraints). When cross-compiling, you must specify a C cross-compiler for cgo to use. You can do this by setting the generic CC_FOR_TARGET or the