Documentation ¶
Index ¶
- Variables
- func Abort(err error)
- func AbortWithString(msg string)
- func BigEndianUint32(val uint32) []byte
- func BigEndianUint64(val int64) []byte
- func BoolFromQuery(name string, r *http.Request) bool
- func BytesToString(data []byte) string
- func CRC32(input []byte) []byte
- func CloneStringSlice(a []string) []string
- func Contains(target string, list []string) bool
- func CreateFile(fullPath string) (*os.File, error)
- func DefaultToExecutable(path string) string
- func DirSize(path string) (int64, error)
- func DivideRoundUp(numerator, divisor uint64) uint64
- func DownloadFile(w io.Writer, url string) error
- func EraseInt(a []int, x int) []int
- func EraseString(a []string, x string) []string
- func ExtendedSliceToMultipleOf(multiple int, input []byte) []byte
- func FileExists(path string) bool
- func FileSize(path string) int64
- func FileSizeString(fullPath string) string
- func GetTempFile() (f *os.File, err error)
- func I64ToA(i int64) string
- func InitLogging(filePath string)
- func InvalidArgs(msg string)
- func IsFullPath(path string) bool
- func IsLegalFilePath(path string) error
- func IsLegalUserName(userName string) error
- func Join(dir, subpath string) string
- func MakeFolders(folders []string) (err error)
- func MakeStringOfLen(length int) string
- func Max(x, y int) int
- func Min(x, y int) int
- func NeedArgs(arg string)
- func NumLines(r io.Reader) (int, error)
- func PickUrl(urls []string, preferHttp bool) string
- func PromptForInput(prompt string) string
- func ReadBigEndianInt32(r io.Reader) (v int32, err error)
- func ReadBigEndianInt64(r io.Reader) (v int64, err error)
- func ReadBigEndianUint32(r io.Reader) (v uint32, err error)
- func ReadBigEndianUint64(r io.Reader) (v uint64, err error)
- func ReadByte(r io.Reader) (v byte, err error)
- func ReadExactly(n int, r io.Reader) (data []byte, err error)
- func Rewind(r io.ReadSeeker)
- func RoundUp(numToRound, multiple uint64) uint64
- func SeparatedStringList(separator string, items ...interface{}) string
- func SetLoggingLevel(level LoggingLevel)
- func SetLoggingLevelFromName(level string)
- func StringKeysOf(m map[string]bool) []string
- func StringToBytes(s string) []byte
- func StringToEthAddress(s string) (ea [20]byte)
- func ToJsonString(data interface{}) string
- func WriteLastLines(w io.Writer, filepath string, numLines int)
- func WriteTempFile(r io.Reader) string
- func Yes(prompt string) bool
- type LoggingLevel
Constants ¶
This section is empty.
Variables ¶
var ( LogDebug *log.Logger = log.New(os.Stderr, "Debug ", log.LstdFlags) LogTrace *log.Logger = log.New(os.Stderr, "Trace ", log.LstdFlags) LogInfo *log.Logger = log.New(os.Stderr, "Info ", log.LstdFlags) LogWarning *log.Logger = log.New(os.Stderr, "Warning ", log.LstdFlags) LogError *log.Logger = log.New(os.Stderr, "Error ", log.LstdFlags) )
Functions ¶
func Abort ¶
func Abort(err error)
Abort does nothing if err is nil, otherwise logs the error and exits
func AbortWithString ¶
func AbortWithString(msg string)
func BigEndianUint32 ¶
func BigEndianUint64 ¶
func BoolFromQuery ¶
BoolFromQuery return false if query is missing or set to false
func BytesToString ¶
func CloneStringSlice ¶
func DefaultToExecutable ¶
Default to executable returns full path. If input path is relative, it will considered relative to the the folder of the executable
func DivideRoundUp ¶
func DownloadFile ¶
DownloadFile will download a file from a url. Assumes that url is a file download url
func EraseString ¶
func FileExists ¶
func FileSizeString ¶
func GetTempFile ¶
func InitLogging ¶
func InitLogging(filePath string)
InitLogging initializes a rotating logger. This should be done once by the executable filePath is the full path of the log file
func InvalidArgs ¶
func InvalidArgs(msg string)
func IsFullPath ¶
func IsLegalFilePath ¶
IsLegalFilePath checks for forbidden characters
func IsLegalUserName ¶
IsLegalUserName checks for forbidden characters
func MakeFolders ¶
func MakeStringOfLen ¶
func PromptForInput ¶
PromptForInput prompts on stdin and reads a line. Empty string is returned on error
func Rewind ¶
func Rewind(r io.ReadSeeker)
func SeparatedStringList ¶
func SetLoggingLevel ¶
func SetLoggingLevel(level LoggingLevel)
func SetLoggingLevelFromName ¶
func SetLoggingLevelFromName(level string)
func StringKeysOf ¶
func StringToBytes ¶
func StringToEthAddress ¶
func ToJsonString ¶
func ToJsonString(data interface{}) string
func WriteLastLines ¶
WriteLastLines writes the last numLines from filepath to w
func WriteTempFile ¶
WriteTempFile writes from the reader to a temp file and returns the path of the file or an empty string on error
Types ¶
type LoggingLevel ¶
type LoggingLevel int
const ( LogLevelUnknown LoggingLevel = iota LogLevelTrace LogLevelDebug LogLevelInfo LogLevelWarning LogLevelError )
func GetLoggingLevel ¶
func GetLoggingLevel() LoggingLevel