[!linux] skip # test only works if c-archive implies -shared
[short] skip
-go build -x -buildmode=c-archive -gcflags=all=-shared=false ./override.go
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+go build -x -n -buildmode=c-archive -gcflags=all=-shared=false ./override.go
stderr '^.*/compile (.* )?-shared (.* )?-shared=false'
-- override.go --
[short] skip
[!cgo] skip
-go run -x main.go
+env GOCACHE=$WORK/gocache # Looking for compile flags, so need a clean cache.
+go build -x -n main.go
stderr '"-I[^"]+c flags"' # find quoted c flags
-! stderr '"-I[^"]+c flags".*"-I[^"]+c flags"' # don't find too many quoted c flags
+! stderr '"-I[^"]+c flags".*"-I[^"]+c flags"' # don't find too many quoted c flags per line
stderr '"-L[^"]+ld flags"' # find quoted ld flags
-! stderr '"-L[^"]+c flags".*"-L[^"]+c flags"' # don't find too many quoted ld flags
+! stderr '"-L[^"]+c flags".*"-L[^"]+c flags"' # don't find too many quoted ld flags per line
-- main.go --
package main
// #cgo CFLAGS: -I"c flags"
// #cgo LDFLAGS: -L"ld flags"
import "C"
-func main() {}
\ No newline at end of file
+func main() {}
[!gc] skip 'using -gcflags and -ldflags'
[short] skip
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+
# -gcflags=-e applies to named packages, not dependencies
go build -n -v -gcflags=-e z1 z2
stderr 'compile.* -e.* -p z1'
# dropping -d, we should see a build.
[short] skip
+
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+
go get -x golang.org/x/text/language@14c0d48
stderr 'compile|cp|gccgo .*language\.a$'
[short] skip
# Packages that are only imported in excluded files should not be built.
-go get -x .
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+go get -n -x .
stderr 'compile.* -p m '
! stderr 'compile.* -p example.com/version '
! stderr 'compile.* -p rsc.io/quote '