release

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package release is the port for finding Scrutiny's latest release tag, and the Checker that looks for a New Version in the background.

Index

Constants

View Source
const Module = "github.com/Coombszy/scrutiny"

Module is Scrutiny's module path, as stamped into the binary.

Variables

View Source
var BuildVersion = sync.OnceValue(func() string {
	info, ok := debug.ReadBuildInfo()
	if !ok {
		return ""
	}
	return info.Main.Version
})

BuildVersion is the module version Go stamped into the binary: the tag for `go install …@v0.1.0` or a build of a clean tagged checkout, a pseudo-version for an untagged commit, "(devel)" for `go run`.

Functions

func IsTagged

func IsTagged(v string) bool

IsTagged reports whether v is a tag rather than a dev build: not a pseudo-version, "(devel)" or a dirty (+) build.

func URL

func URL(v string) string

URL is the GitHub page of tag v.

Types

type Checker

type Checker struct {
	Source  Source
	Current string // the running build's version
	// contains filtered or unexported fields
}

Checker looks for a New Version: a release newer than Current.

func (*Checker) Check

func (c *Checker) Check(ctx context.Context)

Check asks the Source for the latest release, keeping the last one found if it cannot say.

func (*Checker) Enabled

func (c *Checker) Enabled() bool

Enabled reports whether Current is a release build worth checking for: dev builds ("(devel)", pseudo-versions, dirty "+" builds) never look.

func (*Checker) NewVersion

func (c *Checker) NewVersion() string

NewVersion is the latest release if it is newer than Current, otherwise "". Dev builds have no New Version, and prereleases are never offered.

func (*Checker) Run

func (c *Checker) Run(ctx context.Context, interval time.Duration)

Run checks now and then every interval until ctx is done; it returns at once for a dev build, which never asks the Source.

type Fake

type Fake struct {
	Version string
	Err     error
	Calls   int
	// contains filtered or unexported fields
}

Fake is an in-memory Source for tests.

func (*Fake) Latest

func (f *Fake) Latest(context.Context) (string, error)

func (*Fake) Set

func (f *Fake) Set(v string)

Set changes the latest version.

type Source

type Source interface {
	// Latest returns the highest release version, e.g. "v0.3.0".
	Latest(ctx context.Context) (string, error)
}

Source finds the latest release tag of a Go module.

Directories

Path Synopsis
Package goproxy finds a module's latest release from a Go module proxy (https://go.dev/ref/mod#goproxy-protocol), as `go install …@latest` would.
Package goproxy finds a module's latest release from a Go module proxy (https://go.dev/ref/mod#goproxy-protocol), as `go install …@latest` would.

Jump to

Keyboard shortcuts

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