ok command-line-arguments (cached)
禁用 cache 进行测试
go test api/cmdb/client_test.go -count=1
ok command-line-arguments (cached)
禁用 cache 进行测试
go test api/cmdb/client_test.go -count=1
安装
brew install go
查看所有版本 方式一
jpuyy-mba:src jpuyy$ brew info go go: stable 1.11.4 (bottled), HEAD Open source programming language to build simple/reliable/efficient software https://golang.org /usr/local/Cellar/go/1.10.3 (8,170 files, 336.8MB) Poured from bottle on 2018-07-31 at 17:27:27 /usr/local/Cellar/go/1.11 (9,273 files, 403.9MB) * Poured from bottle on 2018-09-29 at 11:39:50
查看所有版本 方式二
brew ls --versions | grep go go 1.10.3 1.11 1.11.4
切换
brew switch go 1.11
清理旧版本
brew cleanup go Removing: /usr/local/Cellar/go/1.10.3... (8,170 files, 336.8MB) Removing: /usr/local/Cellar/go/1.11... (9,273 files, 403.9MB) Removing: /Users/jpuyy/Library/Caches/Homebrew/go--1.11.sierra.bottle.tar.gz... (140.4MB)
升级新版本
brew upgrade go
install
go get -u github.com/kardianos/govendor
初始化
govendor init govendor fetch +outside
使用 go get , govendor fetch 遇到下面问题
fatal: unable to access 'https://go.googlesource.com/net/': Server aborted the SSL handshake
解决办法
http_proxy=socks5://127.0.0.1:1080 govendor fetch +outside
或者
$ git config [--global] http.proxy http://proxy.example.com:port 例如: git config --global http.proxy socks5://127.0.0.1:1080
参考
https://github.com/golang/go/wiki/GoGetProxyConfig
go 找到所有的 imports , 先找到所有的目录
find . -type dir | grep -v vendor | grep -v .git | xargs . ./handlers ./logger ./router ./routes ./static
上面就是所有的目录了,执行 go list 找到所有的 imports
go list -f '{{ join .Imports "\n" }}' . ./handlers ./logger ./router ./routes ./static | sort | uniq
当源代码有过修改之后,自动 build 重启
~/go/bin/bee run logan