...

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

Documentation: cmd/go/testdata/script

     1# GOCACHEPROG unset
     2env GOCACHEPROG=
     3
     4go env
     5stdout 'GOCACHEPROG=''?''?'
     6
     7go env -changed
     8! stdout 'GOCACHEPROG'
     9
    10go env -changed -json
    11! stdout 'GOCACHEPROG'
    12
    13# GOCACHEPROG set
    14[short] skip 'compiles and runs a go program'
    15
    16go build -o cacheprog$GOEXE cacheprog.go
    17
    18env GOCACHEPROG=$GOPATH/src/cacheprog$GOEXE
    19
    20go env
    21stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
    22
    23go env -changed
    24stdout 'GOCACHEPROG=''?'$GOCACHEPROG'''?'
    25
    26go env -changed -json
    27stdout '"GOCACHEPROG": ".*cacheprog'$GOEXE'"'
    28
    29-- cacheprog.go --
    30// This is a minimal GOCACHEPROG program that can't actually do anything but exit.
    31package main
    32
    33import (
    34    "encoding/json"
    35    "os"
    36)
    37
    38func 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