@@ -47,6 +47,14 @@ go build -overlay overlay.json -o main_call_asm$GOEXE ./call_asm
47
47
exec ./main_call_asm$GOEXE
48
48
! stdout .
49
49
50
+ # Change the contents of a file in the overlay and ensure that makes the target stale
51
+ go install -overlay overlay.json ./test_cache
52
+ go list -overlay overlay.json -f '{{.Stale}}' ./test_cache
53
+ stdout '^false$'
54
+ cp overlay/test_cache_different.go overlay/test_cache.go
55
+ go list -overlay overlay.json -f '{{.Stale}}' ./test_cache
56
+ stdout '^true$'
57
+
50
58
go list -compiled -overlay overlay.json -f '{{range .CompiledGoFiles}}{{. | printf "%s\n"}}{{end}}' ./cgo_hello_replace
51
59
cp stdout compiled_cgo_sources.txt
52
60
go run ../print_line_comments.go compiled_cgo_sources.txt
@@ -87,6 +95,13 @@ go build -compiler=gccgo -overlay overlay.json -o main_call_asm_gccgo$GOEXE ./ca
87
95
exec ./main_call_asm_gccgo$GOEXE
88
96
! stdout .
89
97
98
+ go install -gccgo -overlay overlay.json ./test_cache
99
+ go list -gccgo -overlay overlay.json -f '{{.Stale}}' ./test_cache
100
+ stdout '^false$'
101
+ cp overlay/test_cache_different.go overlay/test_cache.go
102
+ go list -gccgo -overlay overlay.json -f '{{.Stale}}' ./test_cache
103
+ stdout '^true$'
104
+
90
105
-- m/go.mod --
91
106
// TODO(matloob): how do overlays work with go.mod (especially if mod=readonly)
92
107
module m
@@ -114,6 +129,7 @@ the actual code is in the overlay
114
129
"printpath/main.go": "overlay/printpath.go",
115
130
"printpath/other.go": "overlay2/printpath2.go",
116
131
"call_asm/asm.s": "overlay/asm_file.s",
132
+ "test_cache/main.go": "overlay/test_cache.go",
117
133
"cgo_hello_replace/cgo_header.h": "overlay/cgo_head.h",
118
134
"cgo_hello_replace/hello.c": "overlay/hello.c",
119
135
"cgo_hello_quote/cgo_hello.go": "overlay/cgo_hello_quote.go",
@@ -230,6 +246,22 @@ void say_hello() { puts("hello cgo\n"); fflush(stdout); }
230
246
TEXT ·foo(SB),0,$0
231
247
RET
232
248
249
+ -- m/overlay/test_cache.go --
250
+ package foo
251
+
252
+ import "fmt"
253
+
254
+ func bar() {
255
+ fmt.Println("something")
256
+ }
257
+ -- m/overlay/test_cache_different.go --
258
+ package foo
259
+
260
+ import "fmt"
261
+
262
+ func bar() {
263
+ fmt.Println("different")
264
+ }
233
265
-- m/cgo_hello_quote/hello.c --
234
266
#include <stdio.h>
235
267
0 commit comments