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

     1  # 'go mod init' should not recommend 'go mod tidy' in an empty directory
     2  # (one that contains no non-hidden .go files or subdirectories).
     3  cd empty
     4  go mod init m
     5  ! stderr tidy
     6  cd ..
     7  
     8  # 'go mod init' should recommend 'go mod tidy' if the directory has a .go file.
     9  cd pkginroot
    10  go mod init m
    11  stderr '^go: to add module requirements and sums:\n\tgo mod tidy$'
    12  cd ..
    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.
    16  cd subdir
    17  go mod init m
    18  stderr '^go: to add module requirements and sums:\n\tgo mod tidy$'
    19  cd ..
    20  
    21  -- empty/empty.txt --
    22  Not a .go file. Still counts as an empty project.
    23  -- empty/.hidden/empty.go --
    24  File in hidden directory. Still as an empty project.
    25  -- empty/_hidden/empty.go --
    26  File in hidden directory. Still as an empty project.
    27  -- pkginroot/hello.go --
    28  package vendorimport
    29  -- subdir/sub/empty.txt --
    30  Subdirectory doesn't need to contain a package.
    31  

View as plain text