utils

package
v0.0.0-...-ba4a4a7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MachineID = getMachineID()

Functions

func BinPath

func BinPath() string

func CompileRegexp

func CompileRegexp(regexpText string) *regexp.Regexp

func CurrentDir

func CurrentDir() string

func DirExists

func DirExists(filename string) bool

func FileExists

func FileExists(filename string) bool

func FileRead

func FileRead(filename string) ([]byte, error)

func FileWrite

func FileWrite(filename string, data []byte) error

func GetHTTPProxy

func GetHTTPProxy() func(*http.Request) (*url.URL, error)

func GetHTTPProxyURL

func GetHTTPProxyURL() string

func GetSubDirs

func GetSubDirs(parentDirPath string) ([]string, error)

func GetVolumes

func GetVolumes() []string

func HomeDir

func HomeDir() string

func InfiniteChannel

func InfiniteChannel() (chan<- interface{}, <-chan interface{})

InfiniteChannel returns infinite in and out channels https://medium.com/capital-one-tech/building-an-unbounded-channel-in-go-789e175cd2cd

func ListFilesRecursively

func ListFilesRecursively(path string) ([]string, error)

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

func MustFileRead

func MustFileRead(filename string) []byte

func MustFileWrite

func MustFileWrite(filename string, data []byte)

func MustJsonMarshal

func MustJsonMarshal(v interface{}) []byte

func MustJsonUnmarshal

func MustJsonUnmarshal(bytes []byte, v interface{})

func ParseInt

func ParseInt(text string, def int) int

func PrettyString

func PrettyString(v interface{}) string

func RandomString

func RandomString(n int) string

func ReadDirRecursively

func ReadDirRecursively(path string) ([]os.FileInfo, error)

func ReadLine

func ReadLine() string

func RecentItems

func RecentItems(items []string, item string, maxSize int) []string

func RecentPaths

func RecentPaths(items []string, item string, maxSize int) []string

func RunesText

func RunesText(text string, length int) string

func SetConsoleTitle

func SetConsoleTitle(title string) (int, error)

func SetDefaultHTTPProxy

func SetDefaultHTTPProxy()

func StringsContains

func StringsContains(s []string, e string) bool

func StringsIndex

func StringsIndex(s []string, e string) int

func StringsIndexIC

func StringsIndexIC(s []string, e string) int

func Text

func Text(text string, length int) string

Types

type Actor

type Actor struct {
	// contains filtered or unexported fields
}

func (*Actor) Close

func (t *Actor) Close()

func (*Actor) Do

func (t *Actor) Do(f func())

Do runs the specified func in the using the actor routine

func (*Actor) DoFunc

func (t *Actor) DoFunc(f func() interface{}) interface{}

Do runs the specified func in the using the actor routine and returns the result

func (*Actor) WaitAllDone

func (t *Actor) WaitAllDone()

WaitAllDone waits until all scheduled work has been done

type Bitmask

type Bitmask uint32

func (Bitmask) Has

func (f Bitmask) Has(flag Bitmask) bool

func (*Bitmask) Set

func (f *Bitmask) Set(flag Bitmask)

func (*Bitmask) Toggle

func (f *Bitmask) Toggle(flag Bitmask)

func (*Bitmask) Unset

func (f *Bitmask) Unset(flag Bitmask)

Directories

Path Synopsis
log

Jump to

Keyboard shortcuts

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