deps

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: 0BSD Imports: 18 Imported by: 0

Documentation

Overview

Package deps reports dependencies that are behind their upstream release. It reads manifests out of a repository's default branch and asks the ecosystem's registry what the current version is; it never executes a package manager, so the check needs no runner and no per-repo configuration beyond opting in.

Index

Constants

View Source
const (
	EcoGo    = "go"
	EcoNPM   = "npm"
	EcoCargo = "cargo"
	EcoPyPI  = "pypi"
)

Ecosystems, in the order they are reported.

View Source
const IssueTitle = "Dependency updates available"

IssueTitle is fixed so the issue this worker maintains is recognizable across sweeps, in listings, and to the maintainer.

View Source
const MaxDeps = 300

MaxDeps bounds the work one repository can create for a sweep.

Variables

This section is empty.

Functions

func Body

func Body(branch string, reports []store.DepReport) string

Body renders the issue: one table per ecosystem, sorted, so a diff between sweeps reads as a diff of what is behind.

func IsPrerelease

func IsPrerelease(v string) bool

IsPrerelease reports whether v carries a prerelease marker. Registries mostly hand back stable versions already; this keeps the exceptions from being suggested.

func Newer

func Newer(current, latest string) bool

Newer reports whether latest is a strictly greater release than current. The four ecosystems agree on the part that matters here — dot-separated numbers, optionally followed by a suffix — so one tolerant comparison covers all of them. Anything it cannot read compares equal, which reports nothing rather than reporting noise.

Types

type Client

type Client struct {
	HTTP    *http.Client
	Hosts   map[string]string // overridden in tests
	Version string            // reported in User-Agent
}

Client queries package registries. The zero value is not usable; call NewClient.

func NewClient

func NewClient(version string) *Client

func (*Client) Latest

func (c *Client) Latest(ctx context.Context, eco, name string) (string, error)

Latest returns the current release of one package. A prerelease is reported as no answer: nothing should be nudged onto an rc.

type Dep

type Dep struct {
	Ecosystem string
	Name      string
	Current   string
}

Dep is one direct dependency read from a manifest.

func Scan

func Scan(read ReadFile) []Dep

Scan returns the direct dependencies of every ecosystem whose manifest is present, capped at MaxDeps. Dependencies whose version cannot be pinned to an exact release — a range, a git or path source, a workspace member — are left out: there is nothing meaningful to compare them against.

type ReadFile

type ReadFile func(path string) ([]byte, error)

ReadFile returns a file from the tree being scanned, or an error when it is absent. Manifests are read from the repository root only; a monorepo with manifests in subdirectories is not scanned.

type Worker

type Worker struct {
	St      *store.Store
	Cfg     config.Config
	RepoDir func(owner, name string) string
	Client  *Client
	Tick    time.Duration
}

Worker sweeps repositories that have opted in, comparing their manifests against the registries and maintaining one issue per repository.

func New

func New(st *store.Store, cfg config.Config, repoDir func(owner, name string) string, version string) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Run sweeps until ctx ends.

func (*Worker) Sweep

func (w *Worker) Sweep(ctx context.Context)

Sweep checks every repository whose interval has elapsed. Split from the ticker for tests.

Source Files

  • cargo.go
  • gomod.go
  • manifest.go
  • npm.go
  • python.go
  • registry.go
  • report.go
  • version.go
  • worker.go

Jump to

Keyboard shortcuts

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