...

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

Documentation: cmd/go/testdata/script

     1# Regression test for https://go.dev/issue/51992
     2
     3# 'go mod tidy' should error instead of throwing panic in the situation below.
     4# 1. /tmp/go.mod exists
     5# 2. run 'go mod tidy' in /tmp or in the child directory not having go.mod.
     6
     7[GOOS:plan9] stop  # Plan 9 has no $TMPDIR variable to set.
     8
     9env GOROOT=$TESTGO_GOROOT
    10env TMP=$WORK
    11env TMPDIR=$WORK
    12mkdir $WORK/child
    13
    14! go mod tidy
    15! stdout .
    16stderr 'go: go.mod file not found in current directory or any parent directory'
    17
    18cd $WORK/child
    19! go mod tidy
    20! stdout .
    21stderr 'go: go.mod file not found in current directory or any parent directory'
    22
    23-- $WORK/go.mod --
    24module issue51992
    25
    26go 1.18

View as plain text