Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
1.9.4
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
Linux
What did you do?
Tried to build with cgo, like
#cgo pkg-config: foo
Within our contrived environment, we'll see,
$ $PKG_CONFIG --cflags foo
-pthread -I... -I... -I... -I... -I...
$ $PKG_CONFIG --libs foo
-L... -L... -L... -lfoo -lbar -Wl,--export-dynamic ...
What did you expect to see?
The linker flag -Wl,--export-dynamic
there is rightfully rejected. It ought to be allowed with the CGO_LDFLAGS_ALLOW
environment variable.
What did you see instead?
go build
returned an error,
go build ...: invalid flag in pkg-config --cflags: -Wl,--export-dynamic
And, it may be built, but using CGO_CFLAGS_ALLOW
, not CGO_LDFLAGS_ALLOW
I'll have a fix pushed shortly.