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

     1  # GOCACHEPROG unset
     2  env GOCACHEPROG=
     3  
     4  go env
     5  stdout 'GOCACHEPROG=''?''?'
     6  
     7  go env -changed
     8  ! stdout 'GOCACHEPROG'
     9  
    10  go env -changed -json
    11  ! stdout 'GOCACHEPROG'
    12  
    13  # GOCACHEPROG set
    14  [short] skip 'compiles and runs a go program'
    15  
    16  go build -o cacheprog$GOEXE cacheprog.go
    17  
    18  env GOCACHEPROG=$GOPATH/src/cacheprog$GOEXE
    19  
    20  go env
    21  stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
    22  
    23  go env -changed
    24  stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
    25  
    26  go env -changed -json
    27  stdout '"GOCACHEPROG": ".*cacheprog'$GOEXE'"'
    28  
    29  -- cacheprog.go --
    30  // This is a minimal GOCACHEPROG program that can't actually do anything but exit.
    31  package main
    32  
    33  import (
    34      "encoding/json"
    35      "os"
    36  )
    37  
    38  func main() {
    39      json.NewEncoder(os.Stdout).Encode(map[string][]string{"KnownCommands": {"close"}})
    40      var res struct{}
    41      json.NewDecoder(os.Stdin).Decode(&res)
    42  }

View as plain text