Documentation
¶
Overview ¶
Package modcache implements ports.ModuleProxy against a local Go module cache ($GOMODCACHE) instead of a network module proxy. It is the proxy adapter used in --from-modcache mode.
The module cache stores the module-proxy protocol on disk:
$GOMODCACHE/cache/download/<escapedPath>/@v/<escapedVersion>.{info,mod,zip}
Info and Download read those files directly and compute h1 hashes from the bytes, exactly as the direct (network) proxy does. When an entry is missing — which should not happen after a build has populated the cache — the adapter shells out to `go mod download` to fetch it into the cache, then re-reads. No bytes are ever fetched over kanonarion's own HTTP client.
Index ¶
- type Proxy
- func (p *Proxy) Download(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.ModuleDownload, error)
- func (p *Proxy) DownloadGoMod(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.GoModDownload, error)
- func (p *Proxy) Info(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.ModuleInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is the module-cache-backed proxy adapter.
func New ¶
New constructs a module-cache proxy rooted at dir. goBinary may be empty (the adapter then uses "go" from PATH). projectDir is the module directory used as the working directory for any `go mod download` fallback; it may be empty, in which case the fallback runs in the process working directory.
func (*Proxy) Download ¶
func (p *Proxy) Download(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.ModuleDownload, error)
Download reads the module zip and go.mod from the cache (fetching them first if absent) and returns them with h1 hashes computed from the bytes.
func (*Proxy) DownloadGoMod ¶
func (p *Proxy) DownloadGoMod(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.GoModDownload, error)
DownloadGoMod reads only the module's go.mod from the cache (fetching it first if absent) and returns it with the h1 hash computed from the bytes. It is the go.mod-only counterpart to Download: it never reads or hashes the zip.
func (*Proxy) Info ¶
func (p *Proxy) Info(ctx context.Context, coord coordinate.ModuleCoordinate) (ports.ModuleInfo, error)
Info returns the .info metadata for a module version, fetching it into the cache first if absent. Origin is always nil: VCS provenance is not tracked in module-cache mode.