internal/build: ignore some files in FindMainPackages (#27521)

This commit is contained in:
Delweng 2023-06-20 16:42:13 +08:00 committed by GitHub
parent b1ef0bfe03
commit 84b05d4f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -197,6 +197,9 @@ func FindMainPackages(dir string) []string {
} }
for _, cmd := range cmds { for _, cmd := range cmds {
pkgdir := filepath.Join(dir, cmd.Name()) pkgdir := filepath.Join(dir, cmd.Name())
if !cmd.IsDir() {
continue
}
pkgs, err := parser.ParseDir(token.NewFileSet(), pkgdir, nil, parser.PackageClauseOnly) pkgs, err := parser.ParseDir(token.NewFileSet(), pkgdir, nil, parser.PackageClauseOnly)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)