Help us shape the future of Go! Take the 2026 Go Developer Survey

batch

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package batch runs acurl checks over many URLs.

Index

Constants

View Source
const MaxSitemapSize = 50 << 20

MaxSitemapSize is the largest sitemap file read (the protocol limit is 50 MB uncompressed).

Variables

This section is empty.

Functions

func Dedupe

func Dedupe(urls []string) []string

Dedupe removes repeated URLs, keeping the first occurrence.

func ReadURLs

func ReadURLs(r io.Reader, csvInput bool) ([]string, error)

ReadURLs reads one URL per line, skipping blank lines and # comments. When csvInput is true the input is CSV: the "url" column is used if the header has one, otherwise the first column.

func Run

func Run(ctx context.Context, c Checker, urls []string, opts Options) *types.BatchReport

Run checks every URL and returns the reports in input order.

func SitemapURLs

func SitemapURLs(ctx context.Context, get Getter, root string, limit int) ([]string, error)

SitemapURLs returns up to limit page URLs from the sitemap at root, following sitemap indexes up to two levels deep. Gzipped sitemaps are supported. A limit <= 0 means no limit.

func Summarize

func Summarize(items []types.BatchItem) *types.BatchReport

Summarize builds the batch report and its aggregate summary.

Types

type Checker

type Checker interface {
	Check(ctx context.Context, url string) (*types.ComparisonResult, error)
}

Checker is the part of acurl.Checker that batch needs.

type Getter

type Getter func(ctx context.Context, url string) (status int, body []byte, err error)

Getter performs a GET and returns the status and body.

type Options

type Options struct {
	// Parallel is how many URLs are checked at once. Default 2.
	Parallel int
	// Delay is the minimum time between starting checks on the same host.
	Delay time.Duration
	// Progress, if set, is called after each URL completes.
	Progress func(done, total int, url string)
}

Options configures a batch run.

Jump to

Keyboard shortcuts

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