yagu

package
v0.6.3-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause Imports: 32 Imported by: 12

README

go-utils

Common golang utilities and helpers we use

Documentation

Index

Constants

View Source
const (
	SHA1   = "sha1"
	SHA256 = "sha256"
	MD5    = "md5"
)

SHA1, SHA256, MD5

View Source
const HTTP2_GOAWAY_CHECK = "http2: server sent GOAWAY and closed the connection"

Variables

This section is empty.

Functions

func Bash

func Bash(script string) (string, error)

func BashTmpScriptWithArgs added in v0.5.4

func BashTmpScriptWithArgs(script string, args []string) (string, error)

func BillyCalcDirHash

func BillyCalcDirHash(dir string, FS billy.Filesystem) (string, error)

func BillyCalcFileHash

func BillyCalcFileHash(filename string, FS billy.Filesystem) (string, error)

func BillyCalcHash

func BillyCalcHash(FS billy.Filesystem) (string, error)

func BillyFilenames

func BillyFilenames(dir string, FS billy.Filesystem) ([]string, error)

func BillyGetFilelist added in v0.5.5

func BillyGetFilelist(FS billy.Filesystem) ([]os.FileInfo, error)

func BillyGlobCalcDirHash

func BillyGlobCalcDirHash(dir string, FS billy.Filesystem, includes, excludes []string) (string, error)

func BillyGlobCalcHash

func BillyGlobCalcHash(FS billy.Filesystem, include, exclude []string) (string, error)

func BillyGlobLoadFromZip

func BillyGlobLoadFromZip(zReader *zip.Reader, FS billy.Filesystem, includes, excludes []string) error

Loads an initialized zip.Reader into an initialize billy.Filesystem

func BillyGlobWriteDirToOS

func BillyGlobWriteDirToOS(baseDir string, dir string, FS billy.Filesystem, includes, excludes []string) error

Write dir in FS onto the os filesystem at baseDir

func BillyLoadFromZip

func BillyLoadFromZip(zReader *zip.Reader, FS billy.Filesystem, trimFirstDir bool) error

func BillyReadAll

func BillyReadAll(filename string, FS billy.Filesystem) ([]byte, error)

func BillyReadAllString

func BillyReadAllString(filename string, FS billy.Filesystem) (string, error)

func BillyWriteDirToOS

func BillyWriteDirToOS(baseDir string, dir string, FS billy.Filesystem) error

Writes dir in FS onto the os filesystem at baseDir

func BillyWriteFileToOS

func BillyWriteFileToOS(baseDir string, file string, FS billy.Filesystem) error

Writes file in FS onto the os filesystem at baseDir

func BuildRequest

func BuildRequest(url string) *gorequest.SuperAgent

func CheckPathExists added in v0.5.4

func CheckPathExists(path string) (bool, error)

func CheckShouldInclude

func CheckShouldInclude(filename string, includes, excludes []string) (bool, error)

func CloneRepoIntoDir added in v0.5.4

func CloneRepoIntoDir(srcUrl, srcVer, dest string) error

func CloneRepoIntoTmp added in v0.5.4

func CloneRepoIntoTmp(srcUrl, srcVer string) (string, error)

func CopyDir

func CopyDir(src string, dst string) error

Dir copies a whole directory recursively

func CopyFile

func CopyFile(src, dst string) error

File copies a single file from src to dst

func Exec

func Exec(args []string) (string, error)

func FilesFromGlobs added in v0.6.3

func FilesFromGlobs(patterns []string) ([]string, error)

func FindIdFromName

func FindIdFromName(basePath, name, listOutput string, res interface{}) (string, error)

func GetHash

func GetHash(path string, hashAlgorithm string) (string, error)

Create hash value with local path and a hash algorithm

func IsValidUUID added in v0.5.4

func IsValidUUID(uuid string) bool

func Mkdir

func Mkdir(dir string) error

func NetrcMachines added in v0.5.17

func NetrcMachines() map[string]NetrcMachine

func NewHash

func NewHash(name *string) (hash.Hash, error)

NewHash create an instance of specific hash algorithm

func OpenBrowserCmd added in v0.5.9

func OpenBrowserCmd(url string) (*exec.Cmd, error)

func RenderDir

func RenderDir(src string, dst string, data interface{}) error

Dir copies a whole directory recursively

func RenderDirNameSub

func RenderDirNameSub(src string, dst string, data interface{}) error

Dir copies a whole directory recursively

func RenderFile

func RenderFile(src, dst string, data interface{}) error

File copies a single file from src to dst

func RenderFileNameSub

func RenderFileNameSub(src, dst string, data interface{}) error

func RenderString

func RenderString(template string, data interface{}) (string, error)

func SendGaEvent

func SendGaEvent(cfg GaConfig, evt GaEvent) (string, error)

func SendGaEvents

func SendGaEvents(cfg GaConfig, evts []GaEvent) (string, error)

func SendRequest

func SendRequest(host, queryTemplate string, vars interface{}) (interface{}, error)

func SetupGitAuth added in v0.5.4

func SetupGitAuth(srcUrl, srcVer string, co *git.CloneOptions) error

func SetupGitOptions added in v0.5.4

func SetupGitOptions(srcUrl, srcVer string) (*git.CloneOptions, error)

func SimpleGet

func SimpleGet(url string) (string, error)

func SwapDelimits

func SwapDelimits(content, fromLL, fromLR, fromSL, fromSR, toLL, toLR, toSL, toSR string) string

Types

type GaConfig

type GaConfig struct {
	TID string
	CID string
	IP  string
	UA  string

	CN string
	CS string
	CM string
}

type GaEvent

type GaEvent struct {
	Type     string
	Source   string
	Category string
	Action   string
	Label    string
	Value    int
}

type GaPageview

type GaPageview struct {
	Type     string
	Source   string
	Category string
	Action   string
	Label    string
	Value    int
}

TODO... make this accurate, add a second function, make both funcs specialized XXX see if we can find the API spec and reverse it into gocode

type NetrcMachine added in v0.5.17

type NetrcMachine struct {
	Login    string
	Password string
}

func NetrcCredentials added in v0.5.17

func NetrcCredentials(machine string) (NetrcMachine, error)

type SSHMachine added in v0.5.17

type SSHMachine struct {
	User string
	Keys *ssh.PublicKeys
}

func SSHCredentials added in v0.5.17

func SSHCredentials(machine string) (SSHMachine, error)

Directories

Path Synopsis
Package configdir provides a cross platform means of detecting the system's configuration directories.
Package configdir provides a cross platform means of detecting the system's configuration directories.
Package par implements parallel execution helpers.
Package par implements parallel execution helpers.
bbc
git

Jump to

Keyboard shortcuts

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