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

download

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package download implements checksum-verified file downloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumDB

type ChecksumDB struct {
	// contains filtered or unexported fields
}

ChecksumDB keeps file checksums and tool versions.

func MustLoadChecksums

func MustLoadChecksums(file string) *ChecksumDB

MustLoadChecksums loads a file containing checksums.

func ParseChecksums

func ParseChecksums(input []byte) (*ChecksumDB, error)

ParseChecksums parses a checksum database.

func (*ChecksumDB) DownloadAndVerifyAll

func (db *ChecksumDB) DownloadAndVerifyAll()

DownloadAndVerifyAll downloads all files and checks that they match the checksum given in the database. This task can be used to sanity-check new checksums.

func (*ChecksumDB) DownloadFile

func (db *ChecksumDB) DownloadFile(url, dstPath string) error

DownloadFile downloads a file and verifies its checksum.

func (*ChecksumDB) DownloadFileFromKnownURL

func (db *ChecksumDB) DownloadFileFromKnownURL(dstPath string) error

DownloadFileFromKnownURL downloads a file from the URL defined in the checksum database.

func (*ChecksumDB) Files

func (db *ChecksumDB) Files() iter.Seq[string]

Files returns an iterator over all file names.

func (*ChecksumDB) FindURL

func (db *ChecksumDB) FindURL(basename string) (string, error)

FindURL gets the URL for a file.

func (*ChecksumDB) FindVersion

func (db *ChecksumDB) FindVersion(tool string) (string, error)

FindVersion returns the current known version of a tool, if it is defined in the file.

Jump to

Keyboard shortcuts

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