| 1 |
# Test passing environment variables to scripts with no go command on PATH |
| 2 |
# |
| 3 |
# This is the counterpart to env_var_with_go.txt |
| 4 |
|
| 5 |
unquote noproxy.txt |
| 6 |
unquote withproxy.txt |
| 7 |
dropgofrompath |
| 8 |
|
| 9 |
env BANANA=banana |
| 10 |
env GOPATH=$WORK/ourgopath |
| 11 |
|
| 12 |
env GOPROXY= |
| 13 |
|
| 14 |
# no GOPROXY, no pass-through, no proxy |
| 15 |
testscript -v noproxy.txt |
| 16 |
stdout ^BANANA=$ |
| 17 |
stdout ^GOPATH=$ |
| 18 |
stdout ^GOPROXY=$ |
| 19 |
! stderr .+ |
| 20 |
|
| 21 |
# no GOPROXY, no pass-through, with proxy |
| 22 |
testscript -v withproxy.txt |
| 23 |
stdout ^BANANA=$ |
| 24 |
stdout ^GOPATH=$ |
| 25 |
stdout ^GOPROXY=http://.*/mod$ |
| 26 |
! stderr .+ |
| 27 |
|
| 28 |
# no GOPROXY, with pass-through, no proxy |
| 29 |
testscript -v -e BANANA -e GOPATH -e GOPROXY noproxy.txt |
| 30 |
stdout ^BANANA=banana$ |
| 31 |
stdout ^GOPATH=${WORK@R}[/\\]ourgopath$ |
| 32 |
stdout ^GOPROXY=$ |
| 33 |
! stderr .+ |
| 34 |
|
| 35 |
# no GOPROXY, with pass-through, with proxy |
| 36 |
testscript -v -e BANANA -e GOPATH -e GOPROXY withproxy.txt |
| 37 |
stdout ^BANANA=banana$ |
| 38 |
stdout ^GOPATH=${WORK@R}[/\\]ourgopath$ |
| 39 |
stdout ^GOPROXY=$ |
| 40 |
! stderr .+ |
| 41 |
|
| 42 |
setfilegoproxy $WORK/proxy |
| 43 |
|
| 44 |
# with GOPROXY, no pass-through, no proxy |
| 45 |
testscript -v noproxy.txt |
| 46 |
stdout ^BANANA=$ |
| 47 |
stdout ^GOPATH=$ |
| 48 |
stdout ^GOPROXY=$ |
| 49 |
! stderr .+ |
| 50 |
|
| 51 |
# with GOPROXY, no pass-through, with proxy |
| 52 |
testscript -v withproxy.txt |
| 53 |
stdout ^BANANA=$ |
| 54 |
stdout ^GOPATH=$ |
| 55 |
stdout ^GOPROXY=http://.*/mod$ |
| 56 |
! stderr .+ |
| 57 |
|
| 58 |
# with GOPROXY, with pass-through, no proxy |
| 59 |
testscript -v -e BANANA -e GOPATH -e GOPROXY noproxy.txt |
| 60 |
stdout ^BANANA=banana$ |
| 61 |
stdout ^GOPATH=${WORK@R}[/\\]ourgopath$ |
| 62 |
stdout ^GOPROXY=$GOPROXY$ |
| 63 |
! stderr .+ |
| 64 |
|
| 65 |
# with GOPROXY, with pass-through, with proxy |
| 66 |
testscript -v -e BANANA -e GOPATH -e GOPROXY withproxy.txt |
| 67 |
stdout ^BANANA=banana$ |
| 68 |
stdout ^GOPATH=${WORK@R}[/\\]ourgopath$ |
| 69 |
stdout ^GOPROXY=$GOPROXY$ |
| 70 |
! stderr .+ |
| 71 |
|
| 72 |
-- noproxy.txt -- |
| 73 |
>env BANANA |
| 74 |
>env GOPATH |
| 75 |
>env GOPROXY |
| 76 |
|
| 77 |
-- withproxy.txt -- |
| 78 |
>env BANANA |
| 79 |
>env GOPATH |
| 80 |
>env GOPROXY |
| 81 |
|
| 82 |
>-- .gomodproxy/fruit.com_v1.0.0/.mod -- |
| 83 |
>module fruit.com |
| 84 |
> |
| 85 |
>-- .gomodproxy/fruit.com_v1.0.0/.info -- |
| 86 |
>{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} |
| 87 |
> |
| 88 |
>-- .gomodproxy/fruit.com_v1.0.0/go.mod -- |
| 89 |
>module fruit.com |
| 90 |
> |
| 91 |
>-- .gomodproxy/fruit.com_v1.0.0/fruit/fruit.go -- |
| 92 |
>package fruit |
| 93 |
> |
| 94 |
>const Apple = "apple" |
| 95 |
>-- .gomodproxy/fruit.com_v1.0.0/coretest/coretest.go -- |
| 96 |
>// package coretest becomes a candidate for the missing |
| 97 |
>// core import in main above |
| 98 |
>package coretest |
| 99 |
> |
| 100 |
>const Mandarin = "mandarin" |