summaryrefslogtreecommitdiff
path: root/src/go.mod
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2021-05-18 23:29:14 -0400
committerDmitri Shuralyov <dmitshur@golang.org>2021-05-19 15:20:08 +0000
commit6c1c055d1ea417d050503efe92c1eead0da68cef (patch)
tree140bc2bc75a1702f409f108e0f6910be204edaff /src/go.mod
parent658b5e66ecbc41a49e6fb5aa63c5d9c804cf305f (diff)
downloadgo-git-6c1c055d1ea417d050503efe92c1eead0da68cef.tar.gz
cmd/internal/moddeps: use filepath.SkipDir only on directories
If a filepath.WalkFunc returns filepath.SkipDir when invoked on a non-directory file, it skips the remaining files in the containing directory.¹ CL 276272 accidentally added a code path that triggers this behavior whenever filepath.Walk reaches a non-directory file that begins with a dot, such as .gitattributes or .DS_Store, causing findGorootModules to return early without finding any modules in GOROOT. Tests that use it ceased to provide test coverage that the tree is tidy. Add an explicit check for info.IsDir in the 5 places that intend to use filepath.SkipDir to skip traversing that directory. Even paths like GOROOT/bin and GOROOT/pkg which are unlikely to be anything but a directory are worth checking, since the goal of moddeps is to take a possibly problematic GOROOT tree as input and detect problems. While the goal of findGorootModules is to find all modules in GOROOT programmatically (in case new modules are added or modified), there are 4 modules now that are quite likely to exist, so check for their presence to avoid similar regressions. (It's not hard to update this test if a well-known GOROOT module is removed or otherwise modified; but if it becomes hard we can simplify it to check for a reasonable number of modules instead.) Also fix the minor skew that has crept in since the test got disabled. ¹ This wasn't necessarily an intentional design decision, but it was found only when Go 1.4 was already out. See CL 11690 for details. Fixes #46254. Change-Id: Id55ed926f8c0094b1af923070de72bacca05996f Reviewed-on: https://go-review.googlesource.com/c/go/+/320991 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
Diffstat (limited to 'src/go.mod')
-rw-r--r--src/go.mod2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/go.mod b/src/go.mod
index 93ff2d8d3c..379dcf504e 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -5,6 +5,6 @@ go 1.17
require (
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
golang.org/x/net v0.0.0-20210510120150-4163338589ed
- golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
+ golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 // indirect
golang.org/x/text v0.3.7-0.20210503195748-5c7c50ebbd4f // indirect
)