...

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

Documentation: cmd/go/testdata/script

     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=
     9go generate .
    10
    11[!GOOS:plan9] env PATH=$WORK${/}bin
    12[GOOS:plan9] env path=$WORK${/}bin
    13go generate .
    14
    15-- go.mod --
    16module example
    17
    18go 1.19
    19-- main.go --
    20//go:generate go run .
    21
    22package main
    23
    24import (
    25	"fmt"
    26	"os"
    27	"os/exec"
    28)
    29
    30func 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 --
    38This directory contains no executables.

View as plain text