mbecker
3/8/2019 - 10:18 PM

Golang cheatsheet #golang #cheatsheet

Golang cheatsheet #golang #cheatsheet

mod

Migrating from dep to Go 1.11 modules

https://blog.callr.tech/migrating-from-dep-to-go-1.11-modules/

- move your code outside of GOPATH
- go mod init [module path]: this will import dependencies from Gopkg.lock.
- go mod tidy: this will remove unnecessary imports, and add indirect ones.
- rm -fr vendor/
- go build: is everthing ok?
- rm -f Gopkg.lock Gopkg.toml
- git commit -m 'chore(dep): migrated from dep to Go 1.11 modules'

Clearing the module cache

https://github.com/golang/go/issues/27238

go clean -modcache