摘要:
在为某个项目添加了通过命令行获取指定配置的模块后,在一些模块内部跑test发生了如下错误: flag provided but not defined: -test.timeout 很显然,跑go test时涉及到了flag解析。 go test是以package为单位进行测试的(无论是否通过-ru 阅读全文
摘要:
time package - time - pkg.go.dev 本文就不对官方文档做详细解析了,只贴一些常用的示例。如需查看官网点击上述链接即可。 一、时间的加减以及格式化示例: func main() { s := time.Now().Add(time.Hour * -2) now := fm 阅读全文
摘要:
yaml与toml是当前流行度较高的两种配置文件类型,其解析方式也非常类似,因此本文将他们合在一起讲。 go-yaml/yaml: YAML support for the Go language. (github.com) BurntSushi/toml: TOML parser for Gola 阅读全文
摘要:
关于run_once和when: when Conditional expression, determines if an iteration of a task is run or not. run_once Boolean that will bypass the host loop, for 阅读全文