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

     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  
     9  env GOROOT=$TESTGO_GOROOT
    10  env TMP=$WORK
    11  env TMPDIR=$WORK
    12  mkdir $WORK/child
    13  
    14  ! go mod tidy
    15  ! stdout .
    16  stderr 'go: go.mod file not found in current directory or any parent directory'
    17  
    18  cd $WORK/child
    19  ! go mod tidy
    20  ! stdout .
    21  stderr 'go: go.mod file not found in current directory or any parent directory'
    22  
    23  -- $WORK/go.mod --
    24  module issue51992
    25  
    26  go 1.18
    27  

View as plain text