install

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install downloads, verifies and installs the pinned Chrome for Testing build that Daisybell drives. Daisybell never uses any other browser binary (SPEC §2.1).

Index

Constants

View Source
const DefaultBaseURL = "https://storage.googleapis.com/chrome-for-testing-public"

DefaultBaseURL is the official Chrome for Testing download root. Mirrors use the same layout.

View Source
const PinnedVersion = "154.0.8037.92"

PinnedVersion is the Chrome for Testing build Daisybell uses (Stable channel as of 2026-10-03). Bumping it requires updating pinnedArtifacts below.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(root, current string)

Cleanup keeps the current version plus the newest previous one and removes leftovers.

func CompareVersions

func CompareVersions(a, b string) int

CompareVersions compares dotted numeric versions; it returns -1, 0 or 1.

func ExecutableRel

func ExecutableRel(platform string) string

ExecutableRel is the executable path inside the extracted zip, slash-separated.

func Extract

func Extract(zipPath, dest string) error

Extract unzips zipPath into dest, preserving permissions and relative symlinks (macOS .app bundles need them) and rejecting entries that would escape dest.

func ParseDownloadURL

func ParseDownloadURL(data []byte, platform string) (string, error)

ParseDownloadURL extracts the chrome zip URL for platform from a version JSON document.

func ParseVersion

func ParseVersion(out string) string

ParseVersion extracts "154.0.8037.92" from "Google Chrome for Testing 154.0.8037.92".

func Platform

func Platform(goos, goarch string) (string, bool)

Platform maps GOOS/GOARCH to a Chrome for Testing platform name.

func RunVersion

func RunVersion(ctx context.Context, exe string) (string, error)

RunVersion runs "<exe> --version". On Windows chrome.exe prints nothing, so the version is read from the "<version>.manifest" file next to the executable.

func VersionURL

func VersionURL(version string) string

VersionURL is the official JSON endpoint describing one version's downloads.

func ZipURL

func ZipURL(base, version, platform string) string

ZipURL builds the download URL using the official path layout.

Types

type Artifact

type Artifact struct {
	Size int64
	MD5  string // base64, as in x-goog-hash: md5=...
}

Artifact is what we expect to download for one platform: exact byte size and the base64 MD5 that Google Cloud Storage publishes in the x-goog-hash header. Pinning both in the binary means a tampered or truncated download is rejected even when served over a proxy or mirror.

func PinnedArtifact

func PinnedArtifact(version, platform string) (Artifact, bool)

PinnedArtifact returns the expected artifact for platform when version is the pinned one.

type Installer

type Installer struct {
	Root     string // e.g. ~/.daisybell/browsers
	Version  string
	Platform string
	// BaseURL, when set, is a mirror with the official path layout; the version JSON is skipped.
	BaseURL string
	// VersionJSON is the endpoint describing the version's downloads (overridable in tests).
	VersionJSON string
	Client      *http.Client
	// Progress receives human-readable progress lines (stderr in production). May be nil.
	Progress io.Writer
	// VersionOf runs the executable and reports its version (overridable in tests).
	VersionOf func(ctx context.Context, exe string) (string, error)
	// Expected, when non-nil, pins the size and MD5 of the zip.
	Expected *Artifact
}

Installer installs one Chrome for Testing version into Root/<version>.

func New

func New(root string, progress io.Writer) (*Installer, error)

New returns the production installer for the pinned version on the current platform. The HTTP client honours HTTPS_PROXY/HTTP_PROXY/NO_PROXY.

func (*Installer) Dir

func (i *Installer) Dir() string

Dir is the install directory of the version.

func (*Installer) DownloadURL

func (i *Installer) DownloadURL(ctx context.Context) (string, error)

DownloadURL resolves the zip URL: mirror layout if BaseURL is set, otherwise the official JSON (falling back to the official layout when the JSON is unreachable).

func (*Installer) Ensure

func (i *Installer) Ensure(ctx context.Context) (string, error)

Ensure returns the executable, installing the browser first if needed.

func (*Installer) Executable

func (i *Installer) Executable() string

Executable is the path of the browser executable (it may not exist yet).

func (*Installer) Install

func (i *Installer) Install(ctx context.Context) (string, error)

Install downloads, verifies and atomically installs the browser. It returns the executable.

func (*Installer) InstallZip

func (i *Installer) InstallZip(ctx context.Context, zipPath string) (string, error)

InstallZip extracts the zip into a staging directory, verifies the executable reports the expected version, then renames the staging directory into place.

func (*Installer) Installed

func (i *Installer) Installed() bool

Installed reports whether a verified install is present.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL