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

     1  # Test query for non-defaults in the env
     2  
     3  env GOROOT=./a
     4  env GOTOOLCHAIN=local
     5  env GOSUMDB=nodefault
     6  env GOPROXY=nodefault
     7  env GO111MODULE=auto
     8  env CGO_CFLAGS=nodefault
     9  env CGO_CPPFLAGS=nodefault
    10  
    11  go env -changed
    12  # linux output like GOTOOLCHAIN='local'
    13  # windows output like GOTOOLCHAIN=local
    14  stdout 'GOTOOLCHAIN=''?local''?'
    15  stdout 'GOSUMDB=''?nodefault''?'
    16  stdout 'GOPROXY=''?nodefault''?'
    17  stdout 'GO111MODULE=''?auto''?'
    18  stdout 'CGO_CFLAGS=''?nodefault''?'
    19  stdout 'CGO_CPPFLAGS=''?nodefault''?'
    20  
    21  go env -changed -json
    22  stdout '"GOTOOLCHAIN": "local"'
    23  stdout '"GOSUMDB": "nodefault"'
    24  stdout '"GOPROXY": "nodefault"'
    25  stdout '"GO111MODULE": "auto"'
    26  stdout '"CGO_CFLAGS": "nodefault"'
    27  stdout '"CGO_CPPFLAGS": "nodefault"'
    28  
    29  [GOOS:windows] env GOOS=linux
    30  [!GOOS:windows] env GOOS=windows
    31  [GOARCH:amd64] env GOARCH=arm64
    32  [!GOARCH:amd64] env GOARCH=amd64
    33  
    34  go env -changed GOOS
    35  [GOOS:windows] stdout 'set GOOS=linux'
    36  [!GOOS:windows] stdout 'GOOS=''windows'''
    37  go env -changed GOARCH
    38  [GOARCH:amd64] stdout 'set GOARCH=arm64|GOARCH=''arm64'''
    39  [!GOARCH:amd64] stdout 'set GOARCH=amd64|GOARCH=''amd64'''
    40  
    41  go env -changed -json GOOS
    42  [GOOS:windows] stdout '"GOOS": "linux"'
    43  [!GOOS:windows] stdout '"GOOS": "windows"'
    44  go env -changed -json GOARCH
    45  [GOARCH:amd64] stdout '"GOARCH": "arm64"'
    46  [!GOARCH:amd64] stdout '"GOARCH": "amd64"'
    47  
    48  env GOPROXY=s
    49  go env -changed GOPROXY
    50  ! stdout 'GOPROXY'
    51  env GOPROXY=s2
    52  go env -changed GOPROXY
    53  stdout 'GOPROXY=''?s2''?'
    54  
    55  env GOROOT=./b
    56  go env -changed
    57  ! stdout 'GOTOOLCHAIN=''?local''?'
    58  
    59  --  a/go.env --
    60  GOPROXY=s
    61  
    62  --  b/go.env --
    63  GOTOOLCHAIN=local
    64  

View as plain text