Change-Id: I4f9a5716bfcb4ef9004debc717cf56acf4a1e461
This commit is contained in:
qiulaidongfeng 2024-01-27 11:26:01 +08:00
parent e3ec749825
commit 675c2bfcbb
1 changed files with 16 additions and 18 deletions

View File

@ -454,24 +454,22 @@ func findGorootModules(t *testing.T) []gorootModule {
if err != nil {
return err
}
if path != root {
if info.IsDir() && (info.Name() == "vendor" || info.Name() == "testdata") {
return filepath.SkipDir
}
if info.IsDir() && path == filepath.Join(testenv.GOROOT(t), "pkg") {
// GOROOT/pkg contains generated artifacts, not source code.
//
// In https://golang.org/issue/37929 it was observed to somehow contain
// a module cache, so it is important to skip. (That helps with the
// running time of this test anyway.)
return filepath.SkipDir
}
if info.IsDir() && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
// _ and . prefixed directories can be used for internal modules
// without a vendor directory that don't contribute to the build
// but might be used for example as code generators.
return filepath.SkipDir
}
if info.IsDir() && path != root && (info.Name() == "vendor" || info.Name() == "testdata") {
return filepath.SkipDir
}
if info.IsDir() && path == filepath.Join(testenv.GOROOT(t), "pkg") {
// GOROOT/pkg contains generated artifacts, not source code.
//
// In https://golang.org/issue/37929 it was observed to somehow contain
// a module cache, so it is important to skip. (That helps with the
// running time of this test anyway.)
return filepath.SkipDir
}
if info.IsDir() && path != root && (strings.HasPrefix(info.Name(), "_") || strings.HasPrefix(info.Name(), ".")) {
// _ and . prefixed directories can be used for internal modules
// without a vendor directory that don't contribute to the build
// but might be used for example as code generators.
return filepath.SkipDir
}
if info.IsDir() || info.Name() != "go.mod" {
return nil