utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureStack

func CaptureStack() string

CaptureStack 捕获当前 goroutine 的调用栈信息,跳过前3层调用栈 固定 64 个 uintptr 数组,栈上分配

func DebugStackLines

func DebugStackLines(stacks string) []string

debugStackLines 获取当前 goroutine 的调用栈信息行切片

func FileExists

func FileExists(filename string) bool

FileExists 检查文件是否存在

func GetExecPath

func GetExecPath() string

GetExecPath 获取当前可执行文件执行时目录

func GetWD

func GetWD() string

GetWD 获取当前工作目录

func JsonValidBytes

func JsonValidBytes(j []byte) bool

JsonValidBytes 检查字节切片是否有效json

func JsonValidString

func JsonValidString(j string) bool

JsonValidString 检查字符串是否时有效json

func NormalizeWhitespace

func NormalizeWhitespace(s string) string

NormalizeWhitespace 规范化字符串中的空白字符,将连续的空白字符替换为单个空格

func StackMsg

func StackMsg() string

StackMsg 获取当前 goroutine 的完整调用栈信息,需将字节切片转为字符串

func UnsafeBytes

func UnsafeBytes(s string) []byte

UnsafeBytes returns a byte pointer without allocation.

copy from goFiber/fiber utils

func UnsafeString

func UnsafeString(b []byte) string

UnsafeString returns a string pointer without allocation

copy from goFiber/fiber utils

func ValidConstant

func ValidConstant(constName interface{}, isZero ...bool) bool

ValidConstant 检查常量是否有效,支持可选参数isZero,true表示检查是否为零值或nil,false表示只检查是否为nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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