aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/get_go_file.txt
blob: bed872098769249e851a30ac13a4957c83aed913 (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
54
55
56
57
58
59
60
# Tests Issue #38478
# Tests that go get in GOPATH mode returns a specific error if the argument
# ends with '.go', and either has no slash or refers to an existing file.

env GO111MODULE=off

# argument doesn't have .go suffix
go get -d test

# argument has .go suffix, is a file and exists
! go get -d test.go
stderr 'go get test.go: arguments must be package or module paths'

# argument has .go suffix, doesn't exist and has no slashes
! go get -d test_missing.go
stderr 'go get test_missing.go: arguments must be package or module paths'

# argument has .go suffix, is a file and exists in sub-directory
! go get -d test/test.go
stderr 'go get: test/test.go exists as a file, but ''go get'' requires package arguments'

# argument has .go suffix, doesn't exist and has slashes
! go get -d test/test_missing.go
! stderr 'arguments must be package or module paths'
! stderr 'exists as a file, but ''go get'' requires package arguments'

# argument has .go suffix, is a symlink and exists
[symlink] symlink test_sym.go -> test.go
[symlink] ! go get -d test_sym.go
[symlink] stderr 'go get test_sym.go: arguments must be package or module paths'
[symlink] rm test_sym.go

# argument has .go suffix, is a symlink and exists in sub-directory
[symlink] symlink test/test_sym.go -> test.go
[symlink] ! go get -d test/test_sym.go
[symlink] stderr 'go get: test/test_sym.go exists as a file, but ''go get'' requires package arguments'
[symlink] rm test_sym.go

# argument has .go suffix, is a directory and exists
mkdir test_dir.go
! go get -d test_dir.go
stderr 'go get test_dir.go: arguments must be package or module paths'
rm test_dir.go

# argument has .go suffix, is a directory and exists in sub-directory
mkdir test/test_dir.go
! go get -d test/test_dir.go
! stderr 'arguments must be package or module paths'
! stderr 'exists as a file, but ''go get'' requires package arguments'
rm test/test_dir.go


-- test.go --
package main
func main() {println("test")}


-- test/test.go --
package main
func main() {println("test")}