Go Package Management

dep / Govendor / Godep

dep https://github.com/golang/dep https://github.com/golang/dep/blob/master/docs/FAQ.md#does-dep-replace-go-get dep vs. go get go get: I want to download the source code for a go project so that I can work on it myself, or to install a tool. This clones the repo under GOPATH for all to use. dep ensure:I have imported a new dependency in my code and want to download the dependency so I can start using it. My workflow is “add the import to the code, and then run dep ensure so that the manifest/lock/vendor are updated”. [Read More]
golang 

Go modules

Go mudules Tutorial

Go modules Reference: * https://blog.golang.org/modules2019 * https://tonybai.com/2018/07/15/hello-go-module/ * https://github.com/golang/go/wiki/Modules * https://www.melvinvivas.com/go-version-1-11-modules/ * https://github.com/golang/go/wiki/Modules Go 1.11 之前,code必须在GOPATH/src路径下,依赖的package也必须在这个目录下,go get下载的包也在 [Read More]
golang 

golang rand生成随机数

简介

  • math/rand package实现了伪随机数字生成器。
  • 随机数字是通过Source生成的,rand.Seed会初始化默认全局的Source,如果不调用rand.Seed就会使用默认的Source。所生成的随机数字是固定顺序生成的,每次运行程序如果seed相同的话,生成随机数是相同的。
  • 默认的Source是线程安全的,自己通过New生成的不是。
[Read More]
golang  code 

golang的测试框架

golang 测试框架 本文主要介绍golang 测试的集中常见的框架。 go test 文件名称位xx_test.go 测试函数Testxxx(t *testing.T) go test -v GoConvey 可以管理和运行 [Read More]
golang  code 

Hugo

为啥搞blog 之前在sina写过复盘日记,后来也没坚持下来;之前在github上用其他框架搭过blog,太繁琐了,也放弃了。 最近在有道云上记 [Read More]
golang  hugo