buildgolang.org/x/build/internal/sourcecache Index | Files

package sourcecache

import "golang.org/x/build/internal/sourcecache"

Package sourcecache provides a cache of code found in Git repositories. It takes directly to the Gerrit instance at go.googlesource.com. If RegisterGitMirrorDial is called, it will first try to get code from gitmirror before falling back on Gerrit.

Index

Functions

func GetSourceTgz

func GetSourceTgz(sl spanlog.Logger, repo, rev string) (tgz io.Reader, err error)

GetSourceTgz returns a Reader that provides a tgz of the requested source revision. repo is go.googlesource.com repo ("go", "net", and so on). rev is git revision.

An error of type TooBigError is returned if the compressed tarball exceeds a size that on 2021-11-22 was deemed to be enough to meet expected legitimate future needs for a while. See golang.org/issue/46379.

func RegisterGitMirrorDial

func RegisterGitMirrorDial(dial func(context.Context) (net.Conn, error))

RegisterGitMirrorDial registers a dial function which will be used to reach gitmirror. If used, this function must be called before GetSourceTgz.

Types

type TooBigError

type TooBigError struct {
	Repo  string
	Rev   string
	Limit int64 // Max size in bytes.
}

TooBigError is the error returned when the source revision is considered too big.

func (TooBigError) Error

func (e TooBigError) Error() string

Source Files

source.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
3 months ago

Tools for package owners.