lib

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "42792ca1c13bdb62dec335861832de5e"

Version ...

Variables

This section is empty.

Functions

func E

func E(args ...interface{}) []interface{}

E if the last arg is error, panic it

func Exec

func Exec(cmd, dir string, args ...string)

Exec cmd

func FileExists

func FileExists(path string) bool

FileExists checks if file exists, only for file, not for dir

func Mkdir

func Mkdir(path string, options *MkdirOptions) error

Mkdir makes dir recursively

func MustToJSON

func MustToJSON(data interface{}) string

MustToJSON encode data to json string

func MustToJSONBytes

func MustToJSONBytes(data interface{}) []byte

MustToJSONBytes encode data to json bytes

func OutputFile

func OutputFile(p string, data interface{}, options *OutputFileOptions) error

OutputFile auto creates file if not exists, it will try to detect the data type and auto output binary, string or json

func RandBytes

func RandBytes(len int) []byte

RandBytes generate random bytes with specified byte length

func ReadFile

func ReadFile(p string) ([]byte, error)

ReadFile reads file as bytes

func ReadJSON

func ReadJSON(p string, data interface{}) error

ReadJSON reads file as json

func Sleep

func Sleep(seconds float64)

Sleep the goroutine for specified seconds, such as 2.3 seconds

Types

type Message

type Message struct {
	UID   string
	PID   int
	Error string
}

Message send between guard processes

type MkdirOptions

type MkdirOptions struct {
	Perm os.FileMode
}

MkdirOptions ...

type OutputFileOptions

type OutputFileOptions struct {
	DirPerm    os.FileMode
	FilePerm   os.FileMode
	JSONPrefix string
	JSONIndent string
}

OutputFileOptions ...

Jump to

Keyboard shortcuts

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