github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_convert_git.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 .git/config 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  # We should not suggest creating a go.mod file in $GOROOT, even though there may be a .git/config there.
    17  cd $GOROOT
    18  ! go list .
    19  ! stderr 'go mod init'
    20  
    21  -- $WORK/test/.git/config --
    22  -- $WORK/test/x/x.go --
    23  package x // import "m/x"