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

package buildgo

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

Package buildgo provides tools for pushing and building the Go distribution on buildlets.

Index

Variables

var TestHookSnapshotExists func(*BuilderRev) bool

Functions

func VersionTgz

func VersionTgz(rev string) io.Reader

VersionTgz returns an io.Reader of a *.tar.gz file containing only a VERSION file containing the contents of the provided rev string.

Types

type BuilderRev

type BuilderRev struct {
	Name string // e.g. "linux-amd64-race"
	Rev  string // lowercase hex core repo git hash

	// optional sub-repository details (both must be present)
	SubName string // e.g. "net"
	SubRev  string // lowercase hex sub-repo git hash
}

BuilderRev is a build configuration type and a revision.

func (BuilderRev) IsSubrepo

func (br BuilderRev) IsSubrepo() bool

func (BuilderRev) RepoOrGo

func (br BuilderRev) RepoOrGo() string

func (*BuilderRev) SnapshotExists

func (br *BuilderRev) SnapshotExists(ctx context.Context, buildEnv *buildenv.Environment) bool

SnapshotExists reports whether the snapshot exists in storage. It returns potentially false negatives on network errors. Callers must not depend on this as more than an optimization.

func (*BuilderRev) SnapshotObjectName

func (br *BuilderRev) SnapshotObjectName() string

SnapshotObjectName is the cloud storage object name of the built Go tree for this builder and Go rev (not the sub-repo). The entries inside this tarball do not begin with "go/".

func (*BuilderRev) SnapshotURL

func (br *BuilderRev) SnapshotURL(buildEnv *buildenv.Environment) string

SnapshotURL is the absolute URL of the snapshot object (see above).

func (BuilderRev) SubRevOrGoRev

func (br BuilderRev) SubRevOrGoRev() string

type Client

type Client struct {
	Env    *buildenv.Environment // generally Production or Staging
	Creds  *google.Credentials
	Client *http.Client // OAuth2 client

	Verbose bool // enable extra debug logging
	// contains filtered or unexported fields
}

Client is an authenticated client to the Go build system.

func NewClient

func NewClient(ctx context.Context, env *buildenv.Environment) (*Client, error)

NewClient returns a new client for using the Go build system in the provided environment. The authentication information is discovered using env.Credentials.

func (*Client) AwaitOp

func (c *Client) AwaitOp(ctx context.Context, op *compute.Operation) error

AwaitOp waits for op to finish. It returns nil if the operating finished successfully.

func (*Client) Compute

func (c *Client) Compute() *compute.Service

Compute returns the GCE compute service.

func (*Client) MakeBasepinDisks

func (c *Client) MakeBasepinDisks(ctx context.Context) error

MakeBasepinDisks looks at the list of all the project's VM images and creates (if needed) a disk for each one, named with the prefix "basepin-". The purpose of these "basepin" disks is to speed up GCE VM creations. When GCE creates a new disk for a new VM, it takes a fast path when creating the disk if there's another disk in the same zone for that image, and makes the new disk a thin Copy-on-Write shadow over the basepin disk. GCE also does this if there's been a VM created within the past N minutes of that type, but we want VMs to always create quickly.

type GoBuilder

type GoBuilder struct {
	spanlog.Logger
	BuilderRev
	Conf *dashboard.BuildConfig
	// Goroot is a Unix-style path relative to the work directory of the
	// builder (e.g. "go").
	Goroot string
	// GorootBootstrap is an optional absolute Unix-style path to the
	// bootstrap toolchain, overriding the default.
	GorootBootstrap string
	// GoDevDLBootstrap is whether the bootstrap comes from go.dev/dl/,
	// meaning its content is inside a directory named "go" as opposed
	// to the root of the archive. GorootBootstrap must be empty if so.
	GoDevDLBootstrap bool
	// Force controls whether to use the -force flag when building Go.
	// See go.dev/issue/56679.
	Force bool
}

A GoBuilder knows how to build a revision of Go with the given configuration.

func (GoBuilder) RunMake

func (gb GoBuilder) RunMake(ctx context.Context, bc buildlet.Client, w io.Writer) (remoteErr, err error)

RunMake builds the toolchain. w is the Writer to send build output to. remoteErr and err are as described at the top of this file.

Source Files

basepin.go buildgo.go client.go

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

Tools for package owners.