sgtool

package
v0.280.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package sgtool provides primitives for downloading and invoking tools.

Index

Constants

View Source
const (
	None archiveType = iota
	Zip
	Tar
	TarGz
)
View Source
const (
	AMD64 = "amd64"
	X8664 = "x86_64"
	ARM64 = "arm64"
)
View Source
const (
	Darwin = "darwin"
)

Variables

This section is empty.

Functions

func CreateSymlink(src string) (string, error)

func FromLocal

func FromLocal(_ context.Context, filepath string, opts ...Opt) error

FromLocal can be used to work with local archive files. HTTP related Options, such as WithHTTPHeader don't do anything here.

func FromRemote

func FromRemote(ctx context.Context, addr string, opts ...Opt) error

func GoInstall

func GoInstall(ctx context.Context, pkg, version string) (string, error)

func GoInstallWithModfile

func GoInstallWithModfile(ctx context.Context, pkg, file string) (string, error)

GoInstallWithModfile builds and installs a go binary given the package and a path to the local go.mod file.

Types

type Opt

type Opt func(f *fileState)

func WithDestinationDir

func WithDestinationDir(path string) Opt

func WithHTTPHeader added in v0.87.0

func WithHTTPHeader(key, value string) Opt

func WithRenameFile

func WithRenameFile(src, dst string) Opt

WithRenameFile renames a source file to the given destination file when writing it. For archives the source file should be the path relative to the root of the archive. If the archive does not contain a file with a matching src path, it is ignored. For direct downloads (no archive) the src does not matter and the output file is stored as per dst. The output file is stored relative to the destination dir given by WithDestinationDir.

func WithSkipIfFileExists

func WithSkipIfFileExists(filepath string) Opt
func WithSymlink(path string) Opt

func WithUntar added in v0.95.0

func WithUntar() Opt

func WithUntarGz

func WithUntarGz() Opt

func WithUnzip

func WithUnzip() Opt

Jump to

Keyboard shortcuts

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