Skip to content

miaoyc666/goArsenal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goArsenal

What is goArsenal?

目标是将goArsenal打造成Golang代码的武器库,要包罗万象。通用函数,代码小工具等等应有尽有

基础语法

基础语法

使用方法

在go.mog中引用github.com/miaoyc666/goArsenal即可使用函数库中的函数

功能列表

  1. aes, aes ecb加解密示例,包含base64转换,对应的python版本aes.py
  2. array, 数组相关操作
  3. chan, chan
  4. crypto, 字符串加密
  5. download, download file
  6. file,文件操作相关
  7. flag, 获取命令行参数
  8. http: http客户端
  9. json, json操作示例,包含多种json库(标准json库、fastjson和gjson)的解析与生成示例
  10. mac addr,获取mac地址列表,获取pci总线上真实的网卡顺序
  11. mongo, mongodb写入与读取
  12. orm, orm
  13. panic, panic
  14. qps test,限制qps测试
  15. re, regexp and regexp2
  16. service register, 接口对象注册注册,可用于业务逻辑抽象,逻辑层与io层分离
  17. system,系统命令调用
  18. udp, udp程序示例
  19. version diff,版本号比较

函数列表

crypt函数列表

  • Md5 获取字符串md5
  • MD5sumFromFile 计算文件md5

logger函数列表

  • Setup 设置日志模块配置
  • Debug/Info/Warn/Error...

http

  • NewHttpClient 新建http客户端,可指定代理和tls参数

Go常见错误

go-mistakes

gotests

# install gotests
go get -u github.com/cweill/gotests/...
# export env
export PATH=$PATH:$GOPATH/bin
# generate all test cases
gotests -all {$filename}

Unit Testing, use go test

  • test file
    go test -v {$testfile} {$sourcefile}
  • test single function
    go test -v {$testfile} {$sourcefile} -test.run {$test case name}
  • run benchmark
    go test -bench=. {$testfile} {$sourcefile}

About

Golang common tools, Golang code arsenal

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages