CFLAGS
is extra flags to give to the C compiler. (commonly used in make, see: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html)
The gopkg.in/h2non/bimg.v1/vips.go uses pkg-config
to generate the extra flags. It has -Xpreprocessor
flag, which is not allowed by CGo (by default at the time of writing this).
For security reasons, only a limited set of flags are allowed, notably -D
, -I
, and -l
. To allow additional flags, set CGO_CFLAGS_ALLOW
to a regular expression matching the new flags. To disallow flags that would otherwise be allowed, set CGO_CFLAGS_DISALLOW
to a regular expression matching arguments that must be disallowed. In both cases the regular expression must match a full argument: to allow -mfoo=bar
, use CGO_CFLAGS_ALLOW='-mfoo.*'
, not just CGO_CFLAGS_ALLOW='-mfoo'
. (See: https://golang.org/cmd/cgo/)
To allow -Xpreprocessor
, you can set CGO_CFLAGS_ALLOW=-Xpreprocessor
.
For example:
CGO_CFLAGS_ALLOW=-Xpreprocessor go vet ./...