req

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

Package req provides methods to resolve Go oriented tooling paths, and if not found attempts to install on demand.

This simplifies other packages so they don't need to worry about installing tools each time. Instead the packages get installed on demand when called.

Example:

Let's say you run mage secrets:check but don't have gitleaks installed.

The package tasks will run the check, but if the binary for gitleaks isn't found, then it would attempt to run the `go install github.com/zricethezav/gitleaks/v8` command, resolve the path, and provide this pack to the caller.

Overtime, I've started migrating more to this approach as it means you have far less concerns for tools like this to run any install/init style setup, and instead just let it self-setup as needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGoPath

func GetGoPath() (gopath string)

GetGoPath returns the GOPATH value.

func QualifyGoBinary

func QualifyGoBinary(binary string) (string, error)

QualifyGoBinary provides a fully qualified path for an installed Go binary to avoid path issues.

func ResolveBinaryByInstall

func ResolveBinaryByInstall(app, goInstallCmd string) (string, error)

ResolveBinaryByInstall tries to qualify the Go tool path, but if can't find it, it will attempt to install and try again once.

This can help with running in CI and not having to have a lot of setup code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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