util

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WaltWhitmanText string

Functions

func AssertEqual

func AssertEqual(t *testing.T, expected, got interface{}) bool

func AssertError

func AssertError(t *testing.T, got interface{}) bool

func AssertExpected

func AssertExpected(t *testing.T, expected, got interface{}) bool

func AssertLen

func AssertLen(t *testing.T, expected, got interface{}) bool

func AssertNil

func AssertNil(t *testing.T, got interface{}) bool

func AssertNoError

func AssertNoError(t *testing.T, got interface{}) bool

func AssertNotNil

func AssertNotNil(t *testing.T, got interface{}) bool

func AssertTrue

func AssertTrue(t *testing.T, got interface{}) bool

func BtoGB

func BtoGB(b uint64) uint64

func BtoKB

func BtoKB(b uint64) uint64

func BtoMB

func BtoMB(b uint64) uint64

func ChecksumCRC32 added in v1.7.0

func ChecksumCRC32(data []byte) uint32

func ChecksumCRC64 added in v1.7.0

func ChecksumCRC64(data []byte) uint64

func CleanPath added in v1.7.0

func CleanPath(path string) (string, string)

func CreateBaseDir added in v1.6.0

func CreateBaseDir(base string) error

func CreateFile added in v1.7.0

func CreateFile(path string) error

func CreateFileSize added in v1.7.0

func CreateFileSize(path string, size int64) error

func DEBUG

func DEBUG(format string, v ...interface{})

func FilePointerOffset added in v1.7.0

func FilePointerOffset(fd *os.File) int64

func FormatTime

func FormatTime(msg string, t1, t2 time.Time) string

func FormattedWidthBytes added in v1.7.0

func FormattedWidthBytes(b []byte, n int) []byte

func FormattedWidthString added in v1.7.0

func FormattedWidthString(s string, n int) string

func GetFilepath

func GetFilepath() (string, string)

GetFilepath returns the absolute filepath from where it's called. It returns the result as a split string, first the root directory up until the current file and returns the two in this order: dir, file

func GetListOfRandomWordsHttp

func GetListOfRandomWordsHttp(num int) []string

func HandleSigInt added in v1.7.0

func HandleSigInt(fn func())

func HandleSignalInterrupt

func HandleSignalInterrupt(msg string, args ...interface{})

func HideFile added in v1.7.0

func HideFile(filename string) error

func InspectStruct

func InspectStruct(v interface{})

func InspectStructV

func InspectStructV(val reflect.Value)

func ListDir added in v1.7.0

func ListDir(path string) error

func MkDir added in v1.7.0

func MkDir(name string) string

func Msg

func Msg(msg string) (string, time.Time)

func NewFileWatch added in v1.7.0

func NewFileWatch(path string)

func OpenFile added in v1.7.0

func OpenFile(path string) (*os.File, error)

func OpenTempFile added in v1.7.0

func OpenTempFile(dir, file string) *os.File

func Pack2U32 added in v1.7.0

func Pack2U32(dst *uint64, src1, src2 uint32)

func PrintStats

func PrintStats(mem runtime.MemStats)

func PrintStatsTab

func PrintStatsTab(mem runtime.MemStats)

func RandBytes added in v1.7.0

func RandBytes(n int) []byte

func RandIntn added in v1.7.0

func RandIntn(min, max int) int

func RandString added in v1.7.0

func RandString(n int) string

func ReadData added in v1.7.0

func ReadData(fd *os.File, data []byte)

func ShutdownHook added in v1.7.0

func ShutdownHook(fn func())

func Sizeof

func Sizeof(objs ...interface{}) (sz uint64)

Sizeof returns the estimated memory usage of object(s) not just the size of the type. On 64bit Sizeof("test") == 12 (8 = sizeof(StringHeader) + 4 bytes).

func StructFields

func StructFields(m interface{}) (string, []reflect.StructField)

func TimeThis

func TimeThis(msg string, start time.Time)

func Trace

func Trace() string

func TruncateFile added in v1.7.0

func TruncateFile(fd *os.File, size int64) error

func Unpack2U32 added in v1.7.0

func Unpack2U32(dst *uint64) (uint32, uint32)

func UpdateBaseDir added in v1.6.0

func UpdateBaseDir(base string) (string, error)

func WalkDir added in v1.7.0

func WalkDir(path string) error

func WatchFile added in v1.7.0

func WatchFile(path string) error

func WriteData added in v1.7.0

func WriteData(fd *os.File, data []byte)

Types

This section is empty.

Directories

Path Synopsis
lowerlevellibs

Jump to

Keyboard shortcuts

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