Documentation ¶
Index ¶
- Variables
- func ArgsFromAny(in []any) []string
- func BinCfssl() *bintool.BinTool
- func BinCfsslJSON() *bintool.BinTool
- func BinGolangCILint() *bintool.BinTool
- func BinGoreleaser() *bintool.BinTool
- func BinGovulncheck() *bintool.BinTool
- func BinInstall(in *bintool.BinTool) error
- func BinKubeControllerEnvTest() *bintool.BinTool
- func BinKubeControllerGen() *bintool.BinTool
- func BinKustomize() *bintool.BinTool
- func BinProtoc() *bintool.BinTool
- func BinProtocGenGo() *bintool.BinTool
- func BinProtocGenGoGRPC() *bintool.BinTool
- func BinProtocGenGoTwirp() *bintool.BinTool
- func BinVerdump() *bintool.BinTool
- func BinWire() *bintool.BinTool
- func BinYQ() *bintool.BinTool
- func Buf() *bintool.BinTool
- func Command(cmd string) ([]byte, error)
- func CommandString(cmd string) (string, error)
- func ContextDefaultValue[T any](ctx context.Context, key ContextKey, defaultValue T) T
- func DownloadToCache(src string, opts ...RestyOpt) (string, error)
- func DownloadToPath(src, dest string, opts ...RestyOpt) (string, error)
- func ExtractArchive(src, dest string, opts ...RestyOpt) error
- func FileAppendLine(filename string, fileperm os.FileMode, line string) error
- func FileChanged(left, right string) bool
- func FileCopy(src string, dst string, overwrite bool) error
- func FileExists(path ...string) bool
- func FileExistsInPath(glob string, path ...string) bool
- func FileHash(filename string) (string, error)
- func FileLastRune(filename string) (rune, error)
- func FileLineExists(filename, targetLine string) bool
- func FileNameModify(target string, fn func(string) []string) []string
- func FileNameModifyReplace(from string, to ...string) func(string) []string
- func FileWrite(data []byte, path string) error
- func FilesMatch(baseDir, pattern string) []string
- func FilterCoverageOutput(filename string) error
- func FirstCommandName() (string, error)
- func GetEnv(key, fallback string) string
- func GetFilenameForURL(src string, opts ...RestyOpt) (string, error)
- func GetGitTopLevel(path ...string) (string, error)
- func GetModuleName() (string, error)
- func GetRelativePath(path string) (string, bool)
- func GitCommitTime() time.Time
- func GitHash() string
- func GitHeadRev() string
- func GitHeadTag() string
- func GitHeadTagDescribe() string
- func GitSemver() string
- func GitSemverRaw() string
- func GitSlug() string
- func GitURL() string
- func GoEnv(key, fallback string) string
- func GolangVersion() string
- func GolangVersionRaw() string
- func HTTPGetLatestGitHubReleaseMatchingTag(slug string, r *regexp.Regexp, opts ...RestyOpt) (string, error)
- func HTTPGetLatestGitHubVersion(slug string, opts ...RestyOpt) (string, error)
- func HTTPWriteFile(rawURL, filename string, eTag *ETagItem, fileperm os.FileMode, ...) error
- func IfErrorf(format string, a ...any) error
- func IfErrorfWrap[T any](format string) func(T, error) (T, error)
- func KubernetesGetCurrentContext() (string, error)
- func KubernetesGetPodWithSelector(selector string) (string, error)
- func LDFlags(debug bool) []string
- func MergeYaml(leftFile, rightFile string) ([]byte, error)
- func Must[T any](in T, err error) T
- func MustCommandPaths() []string
- func MustGetArtifactPath(path ...string) string
- func MustGetGitTopLevel(path ...string) string
- func MustGetGoBin(path ...string) string
- func MustGetHomeDir(path ...string) string
- func MustGetProtobufPath() string
- func MustGetVSCodePath(path ...string) string
- func MustGetWD(path ...string) string
- func MustMakeDir(path string, fileperm os.FileMode)
- func PanicIfError(err error, prependStr string)
- func PrintDebug(format string, v ...any)
- func PrintFileUpdate(format string, v ...any)
- func PrintInfo(format string, v ...any)
- func PrintWarning(format string, v ...any)
- func ProtobufIncludePaths() []string
- func RestyTrace(resp *resty.Response, err error)
- func SanitizeArchivePath(dest, target string) (string, error)
- func SemverBumpPatch(v string) string
- func SetEnv(key, value string) func()
- func TargetNeedRefresh(target string, src ...string) bool
- func Uncompress(src, dest string) error
- func Untargz(src, dest string) error
- func Unzip(src, dest string) error
- type BuildPlatform
- type CommandEnv
- type CommandTemplate
- type ContextKey
- type DockerConfig
- func (d DockerConfig) Args(ctx context.Context) []string
- func (d DockerConfig) ArgsTag(tag string) (string, error)
- func (d DockerConfig) GetImage() string
- func (d DockerConfig) GetImageRef() string
- func (d DockerConfig) GetTags() []string
- func (d DockerConfig) IsBlocked(in string) bool
- func (d DockerConfig) OSArch() []BuildPlatform
- type DockerConfigKubernetes
- type DockerConfigMirrord
- type ETag
- type ETagItem
- type Module
- type ModuleError
- type ProtobufTargetFunc
- type RestyOpt
- type VersionCache
- type VersionKey
Constants ¶
This section is empty.
Variables ¶
var (
ErrFileExists = errors.New("file exists")
)
Functions ¶
func ArgsFromAny ¶ added in v0.1.4
func BinCfsslJSON ¶ added in v0.1.23
BinCfsslJSON returns a singleton for cfssl.
func BinGolangCILint ¶ added in v0.1.3
BinGolangCILint returns a singleton for golangci-lint.
func BinGoreleaser ¶ added in v0.1.10
BinGoreleaser returns a singleton for goreleaser.
func BinGovulncheck ¶ added in v0.1.3
BinGovulncheck returns a singleton for govulncheck.
func BinInstall ¶ added in v0.1.24
func BinKubeControllerEnvTest ¶ added in v0.1.22
BinKubeControllerEnvTest returns a singleton for kubeControllerEnvTest.
func BinKubeControllerGen ¶ added in v0.1.22
BinKubeControllerGen returns a singleton for kubeControllerGen.
func BinKustomize ¶ added in v0.1.22
BinKustomize returns a singleton for kustomize.
func BinProtoc ¶ added in v0.1.3
BinProtoc returns a singleton for protoc, also downloads the includes.
func BinProtocGenGo ¶ added in v0.1.3
BinProtocGenGo returns a singleton for protoc-gen-go.
func BinProtocGenGoGRPC ¶ added in v0.1.3
BinProtocGenGoGRPC returns a singleton for protoc-gen-go-grpc.
func BinProtocGenGoTwirp ¶ added in v0.1.3
BinProtocGenGoTwirp returns a singleton for protoc-gen-twirp.
func BinVerdump ¶ added in v0.1.14
BinVerdump returns a singleton for verdump.
func CommandString ¶ added in v0.1.9
func ContextDefaultValue ¶ added in v0.1.23
func ContextDefaultValue[T any](ctx context.Context, key ContextKey, defaultValue T) T
func DownloadToPath ¶ added in v0.1.16
func ExtractArchive ¶
func FileChanged ¶ added in v0.1.27
func FileExists ¶
FileExists returns true if any path specified exists.
func FileExistsInPath ¶ added in v0.1.14
func FileLastRune ¶
func FileLineExists ¶
func FileNameModifyReplace ¶
func FilesMatch ¶
func FilterCoverageOutput ¶
FilterCoverageOutput filters the coverage output by removing any lines that contain generated protobuf files `.pg.go`.
func FirstCommandName ¶ added in v0.1.7
func GetFilenameForURL ¶ added in v0.1.16
func GetGitTopLevel ¶ added in v0.1.16
func GetModuleName ¶
func GetRelativePath ¶ added in v0.1.8
func GitCommitTime ¶ added in v0.1.9
func GitHeadRev ¶
func GitHeadRev() string
func GitHeadTag ¶
func GitHeadTag() string
func GitHeadTagDescribe ¶ added in v0.1.4
func GitHeadTagDescribe() string
func GitSemverRaw ¶ added in v0.1.4
func GitSemverRaw() string
func GolangVersion ¶ added in v0.1.5
func GolangVersion() string
func GolangVersionRaw ¶ added in v0.1.5
func GolangVersionRaw() string
func HTTPGetLatestGitHubReleaseMatchingTag ¶ added in v0.1.10
func HTTPWriteFile ¶
func IfErrorfWrap ¶ added in v0.1.9
func KubernetesGetCurrentContext ¶ added in v0.1.7
func KubernetesGetPodWithSelector ¶ added in v0.1.7
func Must ¶ added in v0.1.7
Must takes a function that returns T, error and if the error is not nil panics, otherwise returns just T.
func MustCommandPaths ¶
func MustCommandPaths() []string
func MustGetArtifactPath ¶ added in v0.1.7
MustGetArtifactPath get artifact directory or panic if unable to.
func MustGetGitTopLevel ¶ added in v0.1.16
func MustGetGoBin ¶
MustGetGoBin get GOBIN.
if GOBIN is not set then attempt to derive its value using GOPATH.
if GOPATH is not set, use (pwd)/artifacts/bin .
func MustGetHomeDir ¶
MustGetHomeDir get user home directory or panic if unable to.
func MustGetProtobufPath ¶
func MustGetProtobufPath() string
func MustGetVSCodePath ¶ added in v0.1.4
MustGetVSCodePath get generated .vscode directory.
if the directory does not exist then it will be created.
if the directory cannot be created then panic.
func MustMakeDir ¶
MustMakeDir make directory, including parents if required.
if unable to make directory then panic.
func PanicIfError ¶
PanicIfError panics if passed error is not nil.
prependStr is optional string to prepend to panic error.
func PrintDebug ¶
PrintDebug prints the passed debug message to stdout in white text with blue chevron.
func PrintFileUpdate ¶ added in v0.1.27
PrintFileUpdate prints the passed message to stdout in white text with magenta chevron.
func PrintInfo ¶
PrintInfo prints the passed info message to stdout in white text with green chevron.
func PrintWarning ¶
PrintWarn prints the passed warning message to stdout in white text with yellow chevron.
func ProtobufIncludePaths ¶
func ProtobufIncludePaths() []string
ProtobufIncludePaths returns the `--proto_path` arguments for the protocol buffer gen command.
func RestyTrace ¶ added in v0.1.16
func RestyTrace(resp *resty.Response, err error)
func SanitizeArchivePath ¶
Sanitize archive file pathing from "G305: Zip Slip vulnerability".
func SemverBumpPatch ¶ added in v0.1.4
func TargetNeedRefresh ¶
func Uncompress ¶ added in v0.1.16
Types ¶
type BuildPlatform ¶ added in v0.1.4
type CommandEnv ¶
type CommandEnv struct {
// contains filtered or unexported fields
}
func (*CommandEnv) Revert ¶
func (e *CommandEnv) Revert()
type CommandTemplate ¶
type CommandTemplate struct { Debug bool CGO string GoOS string GoArch string GoArm string GoVersion string GitRev string GitHash string GitHeadTag string GitSlug string LDFlags string CWD string OutputArtifact string TargetPath string CommandDir string CommandName string HomeDir string }
func NewCommandTemplate ¶
func NewCommandTemplate(debug bool, commandDir string) *CommandTemplate
type ContextKey ¶ added in v0.1.23
type ContextKey string
const (
DockerLocalPlatform ContextKey = "docker-local-platform"
)
type DockerConfig ¶ added in v0.1.4
type DockerConfig struct { Image string `yaml:"image,omitempty"` Platforms []string `yaml:"platforms,omitempty"` Tag interface{} `yaml:"tag,omitempty"` BlockedTags []string `yaml:"blocked_tags,omitempty"` BuildArgs map[string]string `yaml:"build_args,omitempty"` Kubernetes DockerConfigKubernetes `yaml:"kubernetes,omitempty"` Mirrord DockerConfigMirrord `yaml:"mirrord,omitempty"` Ignore []string `yaml:"ignore,omitempty"` }
func DockerLoadConfig ¶ added in v0.1.4
func DockerLoadConfig() (*DockerConfig, error)
func (DockerConfig) ArgsTag ¶ added in v0.1.4
func (d DockerConfig) ArgsTag(tag string) (string, error)
func (DockerConfig) GetImage ¶ added in v0.1.5
func (d DockerConfig) GetImage() string
func (DockerConfig) GetImageRef ¶ added in v0.1.22
func (d DockerConfig) GetImageRef() string
func (DockerConfig) GetTags ¶ added in v0.1.4
func (d DockerConfig) GetTags() []string
func (DockerConfig) IsBlocked ¶ added in v0.1.4
func (d DockerConfig) IsBlocked(in string) bool
func (DockerConfig) OSArch ¶ added in v0.1.4
func (d DockerConfig) OSArch() []BuildPlatform
type DockerConfigKubernetes ¶ added in v0.1.7
type DockerConfigMirrord ¶ added in v0.1.9
type DockerConfigMirrord struct {
Targetless bool `yaml:"targetless,omitempty"`
}
type ETag ¶ added in v0.1.8
type ETag []ETagItem
func ETagLoadConfig ¶ added in v0.1.8
func (ETag) GetRelative ¶ added in v0.1.8
type ETagItem ¶ added in v0.1.8
type Module ¶
type Module struct { Path string `json:"Path"` // module path Query string `json:"Query"` // version query corresponding to this version Version string `json:"Version"` // module version Versions []string `json:"Versions"` // available module versions Replace *Module `json:"Replace"` // replaced by this module Time *time.Time `json:"Time"` // time version was created Update *Module `json:"Update"` // available update (with -u) Main bool `json:"Main"` // is this the main module? Indirect bool `json:"Indirect"` // module is only indirectly needed by main module Dir string `json:"Dir"` // directory holding local copy of files, if any GoMod string `json:"GoMod"` // path to go.mod file describing module, if any GoVersion string `json:"GoVersion"` // go version used in module Retracted []string `json:"Retracted"` // retraction information, if any (with -retracted or -u) Deprecated string `json:"Deprecated"` // deprecation message, if any (with -u) Error *ModuleError `json:"Error"` // error loading module Origin any `json:"Origin"` // provenance of module Reuse bool `json:"Reuse"` // reuse of old module info is safe }
Module is a module returned by `go list`.
func GolangListModules ¶
GolangListModules executes `go list -m all` and returned the parsed Module slice.
type ModuleError ¶
type ModuleError struct {
Err string `json:"Err"` // the error itself
}
ModuleError is the possible error when loading a module.
type ProtobufTargetFunc ¶ added in v0.1.2
type ProtobufTargetFunc func() []string
ProtobufTargetFunc returned by ProtobufTargets, each ProtobufTargetFunc returns a list of `*.proto` files in each directory.
func ProtobufTargets ¶
func ProtobufTargets() []ProtobufTargetFunc
ProtobufTargets returns a slice of functions that return a list of files in a specific directory
example: root |-blah1 [test1.proto, test2.proto] \-blah2 [testa.proto, testb.proto]
returns two functions, one that returns [/root/blah1/test1.proto, /root/blah1/test2.proto] and another that returns [/root/blah2/testa.proto /root/blah2/testb.proto].
type RestyOpt ¶ added in v0.1.16
type RestyOpt func(*resty.Client)
func AddAuthToken ¶ added in v0.1.16
type VersionCache ¶ added in v0.1.7
type VersionCache map[VersionKey]string
func MustVersionLoadCache ¶ added in v0.1.7
func MustVersionLoadCache() *VersionCache
func VersionLoadCache ¶ added in v0.1.7
func VersionLoadCache() (*VersionCache, error)
func (VersionCache) GetVersion ¶ added in v0.1.7
func (vc VersionCache) GetVersion(key VersionKey) string
func (VersionCache) Save ¶ added in v0.1.7
func (vc VersionCache) Save() error
func (VersionCache) SetVersion ¶ added in v0.1.7
func (vc VersionCache) SetVersion(key VersionKey, value string) string
type VersionKey ¶ added in v0.1.7
type VersionKey string
const ( GolangciLintVersion VersionKey = "golangci-lint" GovulncheckVersion VersionKey = "govulncheck" ProtocVersion VersionKey = "protoc" ProtocGenGoVersion VersionKey = "protoc-gen-go" ProtocGenGoGRPCVersion VersionKey = "protoc-gen-go-grpc" ProtocGenGoTwirpVersion VersionKey = "protoc-gen-go-twirp" YQVersion VersionKey = "yq" BufVersion VersionKey = "buf" GoreleaserVersion VersionKey = "goreleaser" WireVersion VersionKey = "wire" VerdumpVersion VersionKey = "verdump" KubeControllerGenVersion VersionKey = "v0.14.0" KustomizeVersion VersionKey = "v5.3.0" KubeControllerEnvTestVersion VersionKey = "latest" CFSSLVersion VersionKey = "cfssl" )
func (VersionKey) Key ¶ added in v0.1.7
func (vk VersionKey) Key() string
func (VersionKey) String ¶ added in v0.1.7
func (vk VersionKey) String() string