aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/get_goroot.txt
blob: 929435ad70c1036d6a2ab2137a2b529589d20bd2 (plain)
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
[!net] skip
env GO111MODULE=off

# Issue 4186. go get cannot be used to download packages to $GOROOT.
# Test that without GOPATH set, go get should fail.

# Fails because GOROOT=GOPATH
env GOPATH=$WORK/tmp
env GOROOT=$WORK/tmp
! go get -d github.com/golang/example/hello
stderr 'warning: GOPATH set to GOROOT'
stderr '\$GOPATH must not be set to \$GOROOT'

# Fails because GOROOT=GOPATH after cleaning.
env GOPATH=$WORK/tmp/
env GOROOT=$WORK/tmp
! go get -d github.com/golang/example/hello
stderr 'warning: GOPATH set to GOROOT'
stderr '\$GOPATH must not be set to \$GOROOT'

env GOPATH=$WORK/tmp
env GOROOT=$WORK/tmp/
! go get -d github.com/golang/example/hello
stderr 'warning: GOPATH set to GOROOT'
stderr '\$GOPATH must not be set to \$GOROOT'

# Make a home directory
mkdir $WORK/home/go

# Fails because GOROOT=$HOME/go so default GOPATH unset.
[windows] env USERPROFILE=$WORK/home
[plan9] env home=$WORK/home
[!windows] [!plan9] env HOME=$WORK/home
env GOPATH=
env GOROOT=$WORK/home/go
! go get -d github.com/golang/example/hello
stderr '\$GOPATH not set'

[windows] env USERPROFILE=$WORK/home/
[plan9] env home=$WORK/home/
[!windows] [!plan9] env HOME=$WORK/home/
env GOPATH=
env GOROOT=$WORK/home/go
! go get -d github.com/golang/example/hello
stderr '\$GOPATH not set'

[windows] env USERPROFILE=$WORK/home
[plan9] env home=$WORK/home
[!windows] [!plan9] env HOME=$WORK/home
env GOPATH=
env GOROOT=$WORK/home/go/
! go get -d github.com/golang/example/hello
stderr '\$GOPATH not set'