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
15 go build -o cacheprog$GOEXE cacheprog.go
16
17 env GOCACHEPROG=$GOPATH/src/cacheprog$GOEXE
18
19 go env
20 stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
21
22 go env -changed
23 stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
24
25 go env -changed -json
26 stdout '"GOCACHEPROG": ".*cacheprog'$GOEXE'"'
27
28 -- cacheprog.go --
29 // This is a minimal GOCACHEPROG program that can't actually do anything but exit.
30 package main
31
32 import (
33 "encoding/json"
34 "os"
35 )
36
37 func main() {
38 json.NewEncoder(os.Stdout).Encode(map[string][]string{"KnownCommands": {"close"}})
39 var res struct{}
40 json.NewDecoder(os.Stdin).Decode(&res)
41 }
View as plain text