github.com/rogpeppe/go-internal@v1.12.1-0.20240509064211-c8567cf8e95f/testscript/testdata/exec_path_change.txt (about)

     1  # If the PATH environment variable is set in the testscript.Params.Setup phase
     2  # or set directly within a script, exec should honour that PATH
     3  
     4  [!exec:go] skip
     5  
     6  env HOME=$WORK${/}home
     7  [windows] env USERPROFILE=$WORK\home
     8  [windows] env LOCALAPPDATA=$WORK\appdata
     9  
    10  cd go
    11  exec go$exe version
    12  stdout 'go version'
    13  exec go$exe build
    14  env PATH=$WORK${/}go${:}$PATH
    15  exec go$exe version
    16  stdout 'This is not go'
    17  
    18  -- go/go.mod --
    19  module example.com/go
    20  
    21  -- go/main.go --
    22  package main
    23  
    24  import "fmt"
    25  
    26  func main() {
    27  	fmt.Println("This is not go")
    28  }