blob: 4a525903b23f11fc0f6cfb2c40af5042f818f41e [file] [log] [blame]
Colin Cross1f805522021-05-14 11:10:59 -07001# 'go mod init' should not recommend 'go mod tidy' in an empty directory
2# (one that contains no non-hidden .go files or subdirectories).
3cd empty
4go mod init m
5! stderr tidy
6cd ..
7
8# 'go mod init' should recommend 'go mod tidy' if the directory has a .go file.
9cd pkginroot
10go mod init m
11stderr '^go: to add module requirements and sums:\n\tgo mod tidy$'
12cd ..
13
14# 'go mod init' should recommend 'go mod tidy' if the directory has a
15# subdirectory. We don't walk the tree to see if it has .go files.
16cd subdir
17go mod init m
18stderr '^go: to add module requirements and sums:\n\tgo mod tidy$'
19cd ..
20
21-- empty/empty.txt --
22Not a .go file. Still counts as an empty project.
23-- empty/.hidden/empty.go --
24File in hidden directory. Still as an empty project.
25-- empty/_hidden/empty.go --
26File in hidden directory. Still as an empty project.
27-- pkginroot/hello.go --
28package vendorimport
29-- subdir/sub/empty.txt --
30Subdirectory doesn't need to contain a package.