Skip to content

basic

理念

组合 而非继承

About commmander

go install 全局 那么装到哪里了呢?

记得用 go help install

Executables are installed in the directory named by the GOBIN environment variable, which defaults to \$GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set

echo $GOPATH 哦

同时也要把 $GOPATH/bin 加到全局 PATH 里 我用 iterm2 直接 ~/.zshrc 里新增就好了

记得 PATH 用 : 隔开

直接 Export 只对 当前 shell 及其子 shell 有效!!

About time

time.getMonth() // from 1
time.Format("15:04:00")

About print

如果直接 print 一个 struct 到 output 里,会是最原始的 struct 的结构,不显示键值对,很难看懂。所以 print 出去的内容一般要是一个 string,json.Marshal 该对象再 string() 下即可。E.g.

buf, _ := json.MarshalIndent(ret, "", " ")
log.Println(string(buf))