blob: 2df16633765fa92d3543d581c9094488bbcd8491 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# Install an env command because Windows and plan9 don't have it.
env GOBIN=$WORK/tmp/bin
go install env.go
[plan9] env path=$GOBIN${:}$path
[!plan9] env PATH=$GOBIN${:}$PATH
# Test generators have access to the environment
go generate ./printenv.go
stdout '^GOARCH='$GOARCH
stdout '^GOOS='$GOOS
stdout '^GOFILE='
stdout '^GOLINE='
stdout '^GOPACKAGE='
stdout '^DOLLAR='
-- env.go --
package main
import (
"fmt"
"os"
)
func main() {
for _, v := range os.Environ() {
fmt.Println(v)
}
}
-- printenv.go --
package main
//go:generate env
|