Documentation ¶
Index ¶
- func DownloadToCache(src string) (string, error)
- func ExtractArchive(src, dest string) error
- func FileAppendLine(filename string, fileperm os.FileMode, line string) error
- func FileExists(path string) bool
- 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 FilesMatch(baseDir, pattern string) []string
- func FilterCoverageOutput(filename string) error
- func GetEnv(key, fallback string) string
- func GetModuleName() (string, error)
- func GetProtobufVersion() string
- func GitHash() string
- func GitHeadRev() string
- func GitHeadTag() string
- func GitSlug() string
- func HTTPGetLatestGitHubVersion(slug string) (string, error)
- func HTTPWriteFile(rawURL, filename string, fileperm os.FileMode) error
- func LDFlags(debug bool) []string
- func MustCommandPaths() []string
- func MustGetGoBin() string
- func MustGetHomeDir(filename ...string) string
- func MustGetOutput(cmd string) string
- func MustGetProtobufPath() string
- func MustGetWD(filename ...string) string
- func MustMakeDir(path string, fileperm os.FileMode)
- func PanicIfError(err error, prependStr string)
- func PrintDebug(format string, v ...any)
- func PrintInfo(format string, v ...any)
- func PrintWarning(format string, v ...any)
- func ProtobufIncludePaths() []string
- func ProtobufTargets() []string
- func SanitizeArchivePath(d, t string) (string, error)
- func SetEnv(key, value string) func()
- func TargetNeedRefresh(target string, src ...string) bool
- func Unzip(src, dest string) error
- type CommandEnv
- type CommandTemplate
- type Module
- type ModuleError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadToCache ¶
func ExtractArchive ¶
func FileExists ¶
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 GetModuleName ¶
func GetProtobufVersion ¶
func GetProtobufVersion() string
func GitHeadRev ¶
func GitHeadRev() string
func GitHeadTag ¶
func GitHeadTag() string
func MustCommandPaths ¶
func MustCommandPaths() []string
func MustGetGoBin ¶
func MustGetGoBin() string
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 MustGetOutput ¶
func MustGetProtobufPath ¶
func MustGetProtobufPath() string
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 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
func ProtobufTargets ¶
func ProtobufTargets() []string
func SanitizeArchivePath ¶
Sanitize archive file pathing from "G305: Zip Slip vulnerability".
func TargetNeedRefresh ¶
Types ¶
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 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 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 }
func GolangListModules ¶
type ModuleError ¶
type ModuleError struct {
Err string `json:"Err"` // the error itself
}