1 # This is a regression test for Issue #56098: Go generate
2 # wasn't initializing workspace mode
3
4 [short] skip
5
6 go generate ./mod
7 cmp ./mod/got.txt want.txt
8
9 -- go.work --
10 go 1.22
11
12 use ./mod
13 -- mod/go.mod --
14 module example.com/mod
15 -- mod/gen.go --
16 //go:generate go run gen.go got.txt
17
18 package main
19
20 import "os"
21
22 func main() {
23 outfile := os.Args[1]
24 os.WriteFile(outfile, []byte("Hello World!\n"), 0644)
25 }
26 -- want.txt --
27 Hello World!
View as plain text