tools

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: BSD-3-Clause Imports: 12 Imported by: ? 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 tools builds the Diagnostics tab's tools view: the Go programs installed in a bin directory, judged by go-fleettools/staletools used as a library (never as a program): staleness for the toolchain and the release each was built from, sumverify for whether sum.golang.org confirms the module it was built from.

Both reach the network (the module proxy, the checksum database), so a Runner does the work on its own goroutine, far apart, and the snapshots only read its last answer. A tool whose file did not change since a pass that gave it a final verdict is not hashed again.

Index

Constants

View Source
const RefreshEvery = 5 * time.Minute

RefreshEvery is how often Run measures again: the proxy answers are cached for six hours by staletools, and only a changed file is hashed again.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Dir     string // the directory scanned
	Display string // how the user writes it (~/.local/bin)
	Want    string // the toolchain the others are compared with

	Scan     func(dirs []string) ([]staleness.Binary, error)
	Releases func(ctx context.Context, modules []string) map[string]staleness.Release
	Verify   func(path string) (sumverify.Result, error)
	Now      func() time.Time
	// contains filtered or unexported fields
}

Engine measures the installed tools. The func fields are the seams a test replaces; Config fills them with staletools.

func New

func New(dir, display, cacheDir string) *Engine

New is the production engine over dir: scanning with staletools' bounds, the module proxy from GOPROXY, the checksum database with its own key and durable files under cacheDir.

func (*Engine) View

func (e *Engine) View(ctx context.Context) *model.Tools

View measures the directory now.

type Runner

type Runner struct {
	Eng *Engine
	// Every is the time between two passes; 0 means RefreshEvery.
	Every time.Duration
	// contains filtered or unexported fields
}

Runner keeps the latest view of an Engine.

func (*Runner) Latest

func (r *Runner) Latest() *model.Tools

Latest is the last view, nil before the first step ended.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run steps now and then every RefreshEvery until ctx ends.

func (*Runner) Step

func (r *Runner) Step(ctx context.Context)

Step measures now.

type Source

type Source struct {
	Inner interface{ Snapshot() model.Snapshot }
	Run   *Runner
}

Source adds the latest tools view to the snapshots of an inner source.

func (Source) Snapshot

func (s Source) Snapshot() model.Snapshot

Snapshot is the inner snapshot with the Tools view attached.

Jump to

Keyboard shortcuts

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