1 # https://go.dev/issue/51473: to avoid the need for generators to rely on
2 # runtime.GOROOT, 'go generate' should run the test with its own GOROOT/bin
3 # at the beginning of $PATH.
4
5 [short] skip
6
7 [!GOOS:plan9] env PATH=
8 [GOOS:plan9] env path=
9 go generate .
10
11 [!GOOS:plan9] env PATH=$WORK${/}bin
12 [GOOS:plan9] env path=$WORK${/}bin
13 go generate .
14
15 -- go.mod --
16 module example
17
18 go 1.19
19 -- main.go --
20 //go:generate go run .
21
22 package main
23
24 import (
25 "fmt"
26 "os"
27 "os/exec"
28 )
29
30 func main() {
31 _, err := exec.LookPath("go")
32 if err != nil {
33 fmt.Println(err)
34 os.Exit(1)
35 }
36 }
37 -- $WORK/bin/README.txt --
38 This directory contains no executables.
39
View as plain text