blob: f65896ca14ee62fdeaabe52dbb8648f8a99fe7f2 (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
env GO111MODULE=on
# Establish baseline behavior, before mucking with file permissions.
go list ./noread/...
stdout '^example.com/noread$'
go list example.com/noread/...
stdout '^example.com/noread$'
go list ./empty/...
stderr 'matched no packages'
[root] stop # Root typically ignores file permissions.
# Make the directory ./noread unreadable, and verify that 'go list' reports an
# explicit error for a pattern that should match it (rather than treating it as
# equivalent to an empty directory).
[windows] skip # Does not have Unix-style directory permissions.
[plan9] skip # Might not have Unix-style directory permissions.
chmod 000 noread
# Check explicit paths.
! go list ./noread
! stdout '^example.com/noread$'
! stderr 'matched no packages'
! go list example.com/noread
! stdout '^example.com/noread$'
! stderr 'matched no packages'
# Check filesystem-relative patterns.
! go list ./...
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern ./...: '
! go list ./noread/...
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern ./noread/...: '
# Check module-prefix patterns.
! go list example.com/...
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern example.com/...: '
! go list example.com/noread/...
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern example.com/noread/...: '
[short] stop
# Check global patterns, which should still
# fail due to errors in the local module.
! go list all
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern all: '
! go list ...
! stdout '^example.com/noread$'
! stderr 'matched no packages'
stderr '^pattern ...: '
-- go.mod --
module example.com
go 1.15
-- noread/noread.go --
// Package noread exists, but will be made unreadable.
package noread
-- empty/README.txt --
This directory intentionally left empty.
|