util

package
v0.0.0-...-3f18df6 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 27 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreWeInContainer

func AreWeInContainer() bool

AreWeInContainer returns true if this process is running inside docker

func Assert

func Assert(condition bool, errorMessage string) error

func Btoi

func Btoi(b bool) int

func ByteCountIEC

func ByteCountIEC(b int64) string

func CheckErr

func CheckErr(err error, args ...string)

func DieOnError

func DieOnError(err error, args ...string)

func DoHttpFetch

func DoHttpFetch(req *http.Request) ([]byte, error)

func DoHttpRequest

func DoHttpRequest(req *http.Request) []byte

func DoesDirectoryExist

func DoesDirectoryExist(path string) bool

func DoesFileExist

func DoesFileExist(file string) bool

func FirstNonEmptyS

func FirstNonEmptyS(values ...string) string

func FirstNonZero

func FirstNonZero(x ...int) int

func FullHost

func FullHost(r *http.Request) string

func Hash

func Hash(algo string, bys []byte) string

func HashStream

func HashStream(algo string, rc io.Reader) string

func IsPortAvailable

func IsPortAvailable(port int) bool

func Log

func Log(message ...interface{})

func LogError

func LogError(message ...interface{})

func LogWarn

func LogWarn(message ...interface{})

func PrintTable

func PrintTable(data [][]string, dividers bool)

func RandomString

func RandomString(n int) string

RandomString returns a random alphanumeric string of length n

func ReadFile

func ReadFile(path string) []byte

func ReadFileLines

func ReadFileLines(path string, send func(string))

func ReduceNumber

func ReduceNumber(input int64, unit int64, base string, prefixes string) string

func RunOnClose

func RunOnClose(f func())

func TrimLen

func TrimLen(s string, l int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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