resolve/gosource: remove files in GOMODCACHE from discovered inputs #639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes that when the Gosource input resolver is used on a Go
application that uses non-vendored 3. party packages, baur fails with:
ERROR: [..] evaluating task status failed: Rel: can't make
$GOMODCACHE/[..] relative to /home/[...]
Imported 3. party packages that aren't vendored are stored by Go in the
GOMODCACHE directory.
When the Gosource resolver resolves a task to sources in the GOMODCACHE,
it replaces the path to the GOMODCACHE in the input file path with
'$GOMODCACHE'. This is done to always have the same reproducible input
files paths, independent of what the actual GOMODCACHE directory is.
The inputresolver afterwards tries to evaluate the repository relative
path of the input file containing the '$GOMODCACHE' which fails with the
error.
The real path to the input file is not known by the inputresolver, which
makes it difficult to track changes in the GOMODCACHE.
Instead of replacing the GOMODCACHE directory in paths, omit returning
files in the GOMODCACHE, same procedure as it is done for stdlib input files.
Instead a task can track and rely on the information in the go.mod or
go.sum files to track changes of 3. party libraries.
If the files in the GOMODCACHE of a downloaded 3. party packages are
modified manually, baur won't notice the change.
Fixes #637
Follow-up: #642