Documentation ¶
Overview ¶
Package goutil Go常用工具包
Index ¶
- func DownloadFile(filePath string, rw http.ResponseWriter) error
- func FormatAppVersion(appVersion, GitCommit, BuildDate string) (string, error)
- func MD5(s string) string
- func PanicToError(f func()) (err error)
- func PanicTrace(err interface{}) string
- func PrintAppVersion(appVersion, GitCommit, BuildDate string)
- func RandNumber(min, max int) int
- func WorkDir() (string, error)
- type WaitGroupWrapper
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
func DownloadFile(filePath string, rw http.ResponseWriter) error
DownloadFile 文件下载
func FormatAppVersion ¶
FormatAppVersion 格式化应用版本信息
func MD5 ¶
MD5 生成MD5摘要
Example ¶
str := "goutil" fmt.Println(MD5(str))
Output: 3fa6e676e7d5c558e9a49b599cbc975f
func PanicToError ¶
func PanicToError(f func()) (err error)
PanicToError Panic转换为error
Example ¶
err := PanicToError(func() { var m map[string]string m["key"] = "value" }) fmt.Println(err)
Output:
func PrintAppVersion ¶
func PrintAppVersion(appVersion, GitCommit, BuildDate string)
PrintAppVersion 打印应用版本
func RandNumber ¶
RandNumber 生成min - max之间的随机数 如果min大于max, panic
Example ¶
num := RandNumber(1, 1000) fmt.Println(num)
Output:
Types ¶
type WaitGroupWrapper ¶
WaitGroupWrapper waitGroup包装
Directories ¶
Path | Synopsis |
---|---|
Package httpclient http客户端
|
Package httpclient http客户端 |
Package slice 数组常用操作
|
Package slice 数组常用操作 |
Click to show internal directories.
Click to hide internal directories.