github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_convert_dep.txt (about) 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 'cannot find main module' 22 ! stderr 'Gopkg.lock' 23 ! stderr 'go mod init' 24 25 -- $WORK/test/Gopkg.lock -- 26 -- $WORK/test/x/x.go -- 27 package x // import "m/x" 28 -- $WORK/gopkgdir/Gopkg.lock/README.txt -- 29 ../Gopkg.lock is a directory, not a file. 30 -- $WORK/gopkgdir/x/x.go -- 31 package x // import "m/x"