Documentation ¶
Index ¶
- Constants
- Variables
- func CatchPanic(title string)
- func CopyFile(dest, source string) error
- func GetCallStackNames(skip, limit int) []string
- func GetEnv(key string, def string) string
- func GetEnvBool(key string) bool
- func GetEnvFloat(key string, def float64) float64
- func GetEnvInt(key string, def int) int
- func GetEnvInt64(key string, def int64) int64
- func GetProjRootDir() string
- func GetProjRootDirOf(path string) string
- func IsFileExist(filename string) bool
- func IsFileNotExist(filename string) bool
- func IsProjRootDir(path string) bool
- func JSONParse(s string, v any) error
- func JSONStringify(v any) string
- func LoadDotEnv(filenames ...string) error
- func MD5Sum(data []byte) string
- func MarshalProtoJSON(msg proto.Message) ([]byte, error)
- func ParseByteCount(s string) (int64, bool)
- func PrettyBytes(nbytes int64) string
- func ReadFileToLines(filename string) ([]string, error)
- func ReadGCPercent() uint64
- func ReadMemoryLimit() string
- func ReadMetrics(category string) map[string]any
- func ReadToLines(rd io.Reader) ([]string, error)
- func SHA1Sum(data []byte) string
- func SHA256Sum(data []byte) string
- func StartProfiler(addr string)
- func TraceStack(skip int, title string, err interface{}, w io.Writer)
- func UnmarshalProtoJSON(b []byte, m proto.Message) error
- type Frame
- type Stack
Constants ¶
View Source
const ( KiB = 1 << 10 MiB = 1 << 20 GiB = 1 << 30 TiB = 1 << 40 )
Variables ¶
View Source
var EssentialProjDirs = []string{"bin", "config", "data", "logs"}
Functions ¶
func CatchPanic ¶
func CatchPanic(title string)
func GetCallStackNames ¶
GetCallStackNames 当前调用栈得名称
func GetEnvInt64 ¶
func GetProjRootDir ¶
func GetProjRootDir() string
func GetProjRootDirOf ¶
func IsFileNotExist ¶
func LoadDotEnv ¶
func MarshalProtoJSON ¶
MarshalProtoJSON 序列化proto消息为json格式
func ParseByteCount ¶
ParseByteCount parses a string that represents a count of bytes. suffixes include B, KiB, MiB, GiB, and TiB represent quantities of bytes as defined by the IEC 80000-13 standard
func ReadFileToLines ¶
ReadFileToLines 把文件内容按一行一行读取
func ReadGCPercent ¶
func ReadGCPercent() uint64
ReadGCPercent see https://pkg.go.dev/runtime/debug#SetGCPercent
func ReadMemoryLimit ¶
func ReadMemoryLimit() string
ReadMemoryLimit see https://pkg.go.dev/runtime/debug#SetMemoryLimit
func ReadMetrics ¶
ReadMetrics 读取指定的metrics see https://pkg.go.dev/runtime/metrics
func StartProfiler ¶
func StartProfiler(addr string)
Types ¶
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.
Click to show internal directories.
Click to hide internal directories.