util

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkingDirectory = workingDirectory()
	ExecuteDirectory = executorDirectory()
	HomeDirectory    = os.Getenv("HOME")
	TempDirectory    = os.TempDir()
	StringBuilder    = strings.Builder{}
)

Functions

func AbsPath

func AbsPath(_file string) string

// e.g. // a.txt -> /home/xxx/a.txt // Makefile -> D:/SOFT/CODE/Makefile

func IsDir

func IsDir(file_ string) bool

func IsEmptyDir

func IsEmptyDir(src string) bool

func IsExist

func IsExist(file_ string) bool

func IsFile

func IsFile(file_ string) bool

func ListDir

func ListDir(_src string) (srcNames []string, _dirNames []string)

func ListDirDeep

func ListDirDeep(_src string) (srcs []string, _folders []string)

func Slice2Map

func Slice2Map(_slice []string, m_ map[string]struct{})

func String2Int

func String2Int(str string) int

func WarpErr

func WarpErr(fc func() (interface{}, error)) interface{}

包裹一个函数 其返回值是 interface{} 类型 err 如果不为nil 则 panic

func WslPathConvent

func WslPathConvent(_wslPath string) string

cover windows path to wsl path D:\soft\code --> /mnt/d/soft/code

Types

This section is empty.

Jump to

Keyboard shortcuts

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