Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  env GO111MODULE=on
     2  
     3  # We should not create a go.mod file unless the user ran 'go mod init' explicitly.
     4  # However, we should suggest 'go mod init' if we can find an alternate config file.
     5  cd $WORK/test/x
     6  ! go list .
     7  stderr 'found Gopkg.lock in .*[/\\]test'
     8  stderr '\s*cd \.\. && go mod init'
     9  
    10  # The command we suggested should succeed.
    11  cd ..
    12  go mod init
    13  go list -m all
    14  stdout '^m$'
    15  
    16  # In Plan 9, directories are automatically created in /n.
    17  # For example, /n/Gopkg.lock always exists, but it's a directory.
    18  # Test that we ignore directories when trying to find alternate config files.
    19  cd $WORK/gopkgdir/x
    20  ! go list .
    21  stderr '^go: go.mod file not found in current directory or any parent directory; see ''go help modules''$'
    22  ! stderr 'Gopkg.lock'
    23  
    24  -- $WORK/test/Gopkg.lock --
    25  -- $WORK/test/x/x.go --
    26  package x // import "m/x"
    27  -- $WORK/gopkgdir/Gopkg.lock/README.txt --
    28  ../Gopkg.lock is a directory, not a file.
    29  -- $WORK/gopkgdir/x/x.go --
    30  package x // import "m/x"
    31  

View as plain text