Skip to content

mockgen: don't run go list in archive mode - #309

Open
podtserkovskiy wants to merge 1 commit into
uber-go:mainfrom
podtserkovskiy:mockgen-skip-golist-archive
Open

mockgen: don't run go list in archive mode#309
podtserkovskiy wants to merge 1 commit into
uber-go:mainfrom
podtserkovskiy:mockgen-skip-golist-archive

Conversation

@podtserkovskiy

Copy link
Copy Markdown
Contributor

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.

Note: source and reflect/gob modes now fail loudly on a genuine go list invocation error (missing toolchain / broken module) where they previously degraded silently — -e keeps ordinary unresolvable-package errors non-fatal.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant