https://github.com/yangfei4913438/gotools
A Golang base module.
https://github.com/yangfei4913438/gotools
go golang gotools yangfei yangfei4913438
Last synced: 6 months ago
JSON representation
A Golang base module.
- Host: GitHub
- URL: https://github.com/yangfei4913438/gotools
- Owner: yangfei4913438
- License: lgpl-3.0
- Created: 2017-01-21T23:13:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-13T05:51:49.000Z (almost 6 years ago)
- Last Synced: 2024-06-20T10:22:06.938Z (12 months ago)
- Topics: go, golang, gotools, yangfei, yangfei4913438
- Language: Go
- Homepage:
- Size: 91.8 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang Tools [](https://app.wercker.com/project/byKey/5fcc7df5c1d51417a43c381aa0ec3de6)
The role of the project: as the basis of other golang project module.
## How to install
Use `go get` to install or upgrade (`-u`) the `gotools` package.go get -u github.com/yangfei4913438/gotools
## Usage
Base Example:```go
package mainimport (
"fmt"
"github.com/yangfei4913438/gotools/base"
"github.com/yangfei4913438/gotools/network"
)func main() {
sh_out, sh_err := base.ShExec("", "ls", "-l")
if sh_err != nil {
fmt.Println("error: ", sh_err.Error())
} else {
fmt.Println("out: ", sh_out)
}fmt.Println(base.ErrorCustom("自定义错误信息").Error())
//获取token,默认32个随机值
fmt.Println(base.GetToken(32, false))//获取token,将32个随机值用MD5进行加密
fmt.Println(base.GetToken(32, true))//这里写的download相对路径,需要创建真实目录
network.UrlDownload("download", "http://dldir1.qq.com/qqfile/QQforMac/QQ_V5.4.1.dmg")//求哈希值
fmt.Println(base.StrMD5("hello"))
fmt.Println(base.StrSHA1("hello"))
fmt.Println(base.StrSHA256("hello"))
fmt.Println(base.StrSHA512("hello"))
}
```Info Example:
Please be patient...