1 # Test query for non-defaults in the env
2
3 # Go+BoringCrypto conflicts with GOFIPS140.
4 [GOEXPERIMENT:boringcrypto] skip
5
6 env GOROOT=./a
7 env GOTOOLCHAIN=local
8 env GOSUMDB=nodefault
9 env GOPROXY=nodefault
10 env GO111MODULE=auto
11 env CGO_CFLAGS=nodefault
12 env CGO_CPPFLAGS=nodefault
13 env GOFIPS140=latest
14
15 go env -changed
16 # linux output like GOTOOLCHAIN='local'
17 # windows output like GOTOOLCHAIN=local
18 stdout 'GOTOOLCHAIN=''?local''?'
19 stdout 'GOSUMDB=''?nodefault''?'
20 stdout 'GOPROXY=''?nodefault''?'
21 stdout 'GO111MODULE=''?auto''?'
22 stdout 'CGO_CFLAGS=''?nodefault''?'
23 stdout 'CGO_CPPFLAGS=''?nodefault''?'
24 stdout 'GOFIPS140=''?latest''?'
25
26 go env -changed -json
27 stdout '"GOTOOLCHAIN": "local"'
28 stdout '"GOSUMDB": "nodefault"'
29 stdout '"GOPROXY": "nodefault"'
30 stdout '"GO111MODULE": "auto"'
31 stdout '"CGO_CFLAGS": "nodefault"'
32 stdout '"CGO_CPPFLAGS": "nodefault"'
33 stdout '"GOFIPS140": "latest"'
34
35 [GOOS:windows] env GOOS=linux
36 [!GOOS:windows] env GOOS=windows
37 [GOARCH:amd64] env GOARCH=arm64
38 [!GOARCH:amd64] env GOARCH=amd64
39
40 go env -changed GOOS
41 [GOOS:windows] stdout 'set GOOS=linux'
42 [!GOOS:windows] stdout 'GOOS=''windows'''
43 go env -changed GOARCH
44 [GOARCH:amd64] stdout 'set GOARCH=arm64|GOARCH=''arm64'''
45 [!GOARCH:amd64] stdout 'set GOARCH=amd64|GOARCH=''amd64'''
46
47 go env -changed -json GOOS
48 [GOOS:windows] stdout '"GOOS": "linux"'
49 [!GOOS:windows] stdout '"GOOS": "windows"'
50 go env -changed -json GOARCH
51 [GOARCH:amd64] stdout '"GOARCH": "arm64"'
52 [!GOARCH:amd64] stdout '"GOARCH": "amd64"'
53
54 env GOARCH=amd64
55 env GOAMD64=v3
56 go env -changed
57 stdout 'GOAMD64=''?v3''?'
58
59 env GOPROXY=s
60 go env -changed GOPROXY
61 ! stdout 'GOPROXY'
62 env GOPROXY=s2
63 go env -changed GOPROXY
64 stdout 'GOPROXY=''?s2''?'
65
66 env GOROOT=./b
67 go env -changed
68 ! stdout 'GOTOOLCHAIN=''?local''?'
69
70 -- a/go.env --
71 GOPROXY=s
72 GOAMD64=v1
73 GOFIPS140=off
74
75 -- b/go.env --
76 GOTOOLCHAIN=local
77
View as plain text