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