Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

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

View as plain text