1

Go 常用的包推荐 (持续更新)

 2 years ago
source link: https://forrestsu.github.io/posts/go/golang-recommend-pkgs/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Go 常用的包推荐 (持续更新)

2020年11月17日
| 字数 651
| Go
| 阅读 55

1 Go 常用工具包推荐

  • 1 stringer 为枚举量生成String()方法

go install golang.org/x/tools/cmd/stringer

  • 2 pretty 格式化打印任意 go 对象,开发测试打印大对象,非常有用 (这样就不用json.Marshal再打印)

go install github.com/kylelemons/godebug

  • 3 GoMock

2 常用开发库

  • 1 http-router

    高性能、可扩展的HTTP路由

  • 2 easyjson

    高性能的Json Codec, 适用于有schema的Json数据

  • 3 set

    set集合数据结构,基于原生 map 实现

3 测试框架

  • 1 goconvey

    简单易用的go测试框架,包含webUI

  • 2 testify

    在 go 中使用断言 assert

Go 版本管理: GoUP工具

a)按照 goup 工具

go install github.com/owenthereal/goup/cmd/goup@latest

b)设置环境变量(zsh)

$ echo 'export PATH="$HOME/.go/current/bin:$PATH"' >> ~/.zshrc

c)安装并使用

# 安装Go版本
$ goup install 1.17.7
$ goup install 1.18beta2
# 设置默认版本
$ goup default 1.17.7

changelist

  • 2022-02-13 增加 goup 使用
  • 2021-06-10 增加 go-set 使用
  • 2020-11-17 初始版本

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK