Text file src/cmd/go/testdata/script/list_perm.txt

     1  env GO111MODULE=on
     2  
     3  # Establish baseline behavior, before mucking with file permissions.
     4  
     5  go list ./noread/...
     6  stdout '^example.com/noread$'
     7  
     8  go list example.com/noread/...
     9  stdout '^example.com/noread$'
    10  
    11  go list ./empty/...
    12  stderr 'matched no packages'
    13  
    14  # Make the directory ./noread unreadable, and verify that 'go list' reports an
    15  # explicit error for a pattern that should match it (rather than treating it as
    16  # equivalent to an empty directory).
    17  
    18  [root] stop # Root typically ignores file permissions.
    19  [GOOS:windows] skip # Does not have Unix-style directory permissions.
    20  [GOOS:plan9] skip   # Might not have Unix-style directory permissions.
    21  
    22  chmod 000 noread
    23  
    24  # Check explicit paths.
    25  
    26  ! go list ./noread
    27  ! stdout '^example.com/noread$'
    28  ! stderr 'matched no packages'
    29  
    30  ! go list example.com/noread
    31  ! stdout '^example.com/noread$'
    32  ! stderr 'matched no packages'
    33  
    34  # Check filesystem-relative patterns.
    35  
    36  ! go list ./...
    37  ! stdout '^example.com/noread$'
    38  ! stderr 'matched no packages'
    39  stderr '^pattern ./...: '
    40  
    41  ! go list ./noread/...
    42  ! stdout '^example.com/noread$'
    43  ! stderr 'matched no packages'
    44  stderr '^pattern ./noread/...: '
    45  
    46  
    47  # Check module-prefix patterns.
    48  
    49  ! go list example.com/...
    50  ! stdout '^example.com/noread$'
    51  ! stderr 'matched no packages'
    52  stderr '^pattern example.com/...: '
    53  
    54  ! go list example.com/noread/...
    55  ! stdout '^example.com/noread$'
    56  ! stderr 'matched no packages'
    57  stderr '^pattern example.com/noread/...: '
    58  
    59  
    60  [short] stop
    61  
    62  # Check global patterns, which should still
    63  # fail due to errors in the local module.
    64  
    65  ! go list all
    66  ! stdout '^example.com/noread$'
    67  ! stderr 'matched no packages'
    68  stderr '^pattern all: '
    69  
    70  ! go list ...
    71  ! stdout '^example.com/noread$'
    72  ! stderr 'matched no packages'
    73  stderr '^pattern ...: '
    74  
    75  
    76  -- go.mod --
    77  module example.com
    78  go 1.15
    79  -- noread/noread.go --
    80  // Package noread exists, but will be made unreadable.
    81  package noread
    82  -- empty/README.txt --
    83  This directory intentionally left empty.
    84  

View as plain text