mockgen: don't run go list in archive mode - #309
Open
podtserkovskiy wants to merge 1 commit into
Open
Conversation
Generate always shelled out to `go list` to resolve import package names, even in archive mode — so mockgen needed the `go` toolchain even when handed a prebuilt export archive, breaking hermetic builds (Buck, Bazel). Archive and package modes now take those names straight from the export data they already load; only source and reflect/gob modes still use `go list`. Generate just consumes the resolved names, falling back to the path basename for the rest. `go list` failures are also surfaced now instead of swallowed (with `-e` so unresolvable imports fall back rather than abort). Adds tests for name resolution and the `go list` helper.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Generate always shelled out to
go listto resolve import package names, even in archive mode — so mockgen needed thegotoolchain even when handed a prebuilt export archive, breaking hermetic builds (Buck, Bazel).Archive and package modes now take those names straight from the export data they already load; only source and reflect/gob modes still use
go list. Generate just consumes the resolved names, falling back to the path basename for the rest.go listfailures are also surfaced now instead of swallowed (with-eso unresolvable imports fall back rather than abort). Adds tests for name resolution and thego listhelper.Note: source and reflect/gob modes now fail loudly on a genuine
go listinvocation error (missing toolchain / broken module) where they previously degraded silently —-ekeeps ordinary unresolvable-package errors non-fatal.