-
Notifications
You must be signed in to change notification settings - Fork 66
/
env_var_with_go.txt
110 lines (94 loc) · 2.69 KB
/
env_var_with_go.txt
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
101
102
103
104
105
106
107
108
109
110
# Test passing environment variables to scripts with the go command on PATH
#
# Below where we check the output of testscript -v, we have to match against
# the string literal $WORK because testscript rewrites the actual directory
# to $WORK. Hence we don't want to expand this script's $WORK in such a comparison.
#
# This is the counterpart to env_var_no_go.txt
unquote noproxy.txt
unquote withproxy.txt
# Baseline
testscript -v noproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]\.gopath'$
stdout ^GOPROXY=https://proxy.golang.org,direct$
! stderr .+
env BANANA=banana
env GOPATH=$WORK/ourgopath
env GOPROXY=
# no GOPROXY, no pass-through, no proxy
testscript -v noproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]\.gopath'$
stdout ^GOPROXY=https://proxy.golang.org,direct$
! stderr .+
# no GOPROXY, no pass-through, with proxy
testscript -v withproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]\.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=\$WORK[/\\]\.gopath'$
stdout ^GOPROXY=$GOPROXY$
! stderr .+
# with GOPROXY, no pass-through, with proxy
testscript -v withproxy.txt
stdout ^BANANA=$
stdout '^GOPATH=\$WORK[/\\]\.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"