go_package_probe
Resolver-owned offline package evaluation against settled Go module versions.
go_workspace generates these targets after
graph-owned module selection. Do not declare them instead of a workspace seed
or ordinary Go package targets.
The target assembles an isolated native-layout module cache from authenticated
graph outputs, then runs native go list with -mod=readonly, or -mod=vendor
for vendored sources. Network acquisition is disabled. The JSON records in
packages.json describe files, imports and tests for the selected build
configuration. Native package evaluation is not allowed to choose different
module versions; mismatches and unresolved package errors stop expansion.
The initial probe discovers local packages without waiting for every source archive. Follow-up consumer probes request only selected modules needed by their imports. Once a consumer's package closure is ready, unrelated source downloads need not delay its build.
Attributes#
| Attribute | Type | Default | Description |
|---|---|---|---|
state | string | required | Resolver-produced JSON containing settled versions, source identities and file inventory |
pattern | string | required | Native package pattern; consumer patterns also request dependency metadata |
tests | bool | false | Include native test-package variants |
all_tags | bool | false | Resolver-owned update mode scanning main roots and explicitly requested packages under native AnyTags rules |
go | string | discovered Go command | Package evaluator command |
cgo | bool | false | Whether cgo participates in the selected configuration |
_go_toolchain | map<string,string> | {} | Resolver-owned selected SDK identity |
_affected_srcs | list<string> | [] | Resolver-owned manifest inputs for conservative graph-wide test selection |
The deps role accepts authenticated go_module providers. The target emits
go_metadata and exposes build with the default output group. Generated
package/test targets own precise source, embed and runtime-data selection.
In all_tags mode, state instead contains module records with logical Path,
execution Directory, Main, optional workspace-relative Workspace, and
explicitly requested import paths in Packages. A bounded import-only reader
handles native build headers without invoking native dependency selection.
The inventory separates ordinary and test imports. Excluded source trees are
not traversed unless a requested package needs them. Local-file digests use
workspace-relative paths; authenticated external source trees remain graph
inputs. The resolver, not this scanner, decides which dependency tests to load.
The scanner caps files at 16 MiB, processed files at 100,000, quoted imports at 10,000 per file, retained metadata at 8 MiB and encoded output at 16 MiB. Workspace-relative digest keys count against the retained budget. Non-UTF-8 identity paths fail instead of being normalized into colliding JSON keys. Explicitly requested providers remain visible even when every Go file is excluded, preserving ambiguity checks. Package-local errors are deferred until a package is reached; admission estimates remain subject to the command's memory budget. Generic resolver-input limits also apply before execution. Neither probe mode discovers undeclared module versions or provides full native update semantics.