...

Text file src/cmd/go/testdata/script/cgo_stale.txt

Documentation: cmd/go/testdata/script

     1# golang.org/issue/46347: a stale runtime/cgo should only force a single rebuild
     2
     3[!cgo] skip
     4[short] skip
     5
     6
     7# If we set a unique CGO_CFLAGS, the installed copy of runtime/cgo
     8# should be reported as stale.
     9
    10env CGO_CFLAGS=-DTestScript_cgo_stale=true
    11stale runtime/cgo
    12
    13
    14# If we then build a package that uses cgo, runtime/cgo should be rebuilt and
    15# cached with the new flag, but not installed to GOROOT.
    16# It has no install target, and thus is never stale.
    17
    18env GOCACHE=$WORK/cache  # Use a fresh cache to avoid interference between runs.
    19
    20go build -x .
    21stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
    22! stale runtime/cgo
    23
    24
    25# After runtime/cgo has been rebuilt and cached, it should not be rebuilt again.
    26
    27go build -x .
    28! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
    29! stale runtime/cgo
    30
    31
    32-- go.mod --
    33module example.com/m
    34
    35go 1.17
    36-- m.go --
    37package m
    38
    39import "C"

View as plain text