...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# Establish baseline behavior, before mucking with file permissions.
     4
     5go list ./noread/...
     6stdout '^example.com/noread$'
     7
     8go list example.com/noread/...
     9stdout '^example.com/noread$'
    10
    11go list ./empty/...
    12stderr '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
    22chmod 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'
    39stderr '^pattern ./...: '
    40
    41! go list ./noread/...
    42! stdout '^example.com/noread$'
    43! stderr 'matched no packages'
    44stderr '^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'
    52stderr '^pattern example.com/...: '
    53
    54! go list example.com/noread/...
    55! stdout '^example.com/noread$'
    56! stderr 'matched no packages'
    57stderr '^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'
    68stderr '^pattern all: '
    69
    70! go list ...
    71! stdout '^example.com/noread$'
    72! stderr 'matched no packages'
    73stderr '^pattern ...: '
    74
    75
    76-- go.mod --
    77module example.com
    78go 1.15
    79-- noread/noread.go --
    80// Package noread exists, but will be made unreadable.
    81package noread
    82-- empty/README.txt --
    83This directory intentionally left empty.

View as plain text