-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/imports: use a clean GOMODCACHE for the scan root directory
The directories processed by gopathwalk are clean, yet in the scan callback are assumed to have the root as a prefix. For the module cache, this root was previous not guaranteed to be clean, if it came from a GOMODCACHE environment variable. As a result, the computed relative path may be inaccurate, and may even panic if the unclean root is much longer than its clean form. Reproduce the crash of golang/go#67156 in a test, update scanDirForPackage to be more robust, and fix the uncleanliness of the module cache root. Also fix some handling of GOMODCACHE cleanup in imports tests. Fixes golang/go#67156 Change-Id: Ia899256fed9629b7e753a52feb02b4235bfc8388 Reviewed-on: https://go-review.googlesource.com/c/tools/+/603635 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
- Loading branch information
Showing
2 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters