gutils

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

gutils

Description

golang utils functions

Installation

go get -v git@gitee.com:wangyubin/gutils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeFileTime added in v0.4.0

func ChangeFileTime(dstFile, srcFile string) error

修改文件的三个时间:将 srcFile 的时间修改为 dstFile 的时间

func ClearFile added in v0.4.0

func ClearFile(fp string) error

ClearFile 清空文件

func CopyFile added in v0.3.3

func CopyFile(src, dst string) error

CopyFile 复制文件

func CountFile added in v0.3.3

func CountFile(fp string) (int, error)

CountFile 统计文件行数

func CreateDir added in v0.3.3

func CreateDir(d string) error

CreateDir 创建文件夹

func ExecScript added in v0.4.0

func ExecScript(script string) ([]byte, error)

ExecScript 执行脚本

func ExecScriptBG added in v0.4.0

func ExecScriptBG(script string) error

后台执行命令

func GetHomeDir added in v0.4.0

func GetHomeDir() (string, error)

GetHomeDir 获取用户主目录

func IsDir added in v0.3.3

func IsDir(fp string) bool

IsDir 是否是文件夹

func IsFile added in v0.4.0

func IsFile(path string) bool

判断所给路径是否为文件

func IsFileExists added in v0.4.0

func IsFileExists(fp string) bool

IsFileExists 文件是否存在

func IsProcessExisted added in v0.4.0

func IsProcessExisted(name string) bool

查询进程是否正常运行

func IsStrInArr added in v0.4.0

func IsStrInArr(s string, arr []string) bool

IsStrInArr 判断数组 arr 中是否包含 s 元素

func KillProcess added in v0.4.0

func KillProcess(name string, force bool) error

关闭某个进程

func RandomPasswd added in v0.4.0

func RandomPasswd(length int) string

func ReadFileLines added in v0.4.0

func ReadFileLines(fp string) ([]string, error)

ReadFileLines 读取文件所有行,适合文件不是特别大的场景

func RemoveDuplicatedArrs added in v0.4.0

func RemoveDuplicatedArrs(arr1, arr2 []string) []string

Types

This section is empty.

Directories

Path Synopsis
clients
aes
des
rsa
storages

Jump to

Keyboard shortcuts

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