...

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

Documentation: cmd/go/testdata/script

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

View as plain text