Skip to content

Instantly share code, notes, and snippets.

@mbecker
Created March 8, 2019 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbecker/fa14bfe7c7717b156c5a6c9fce2f6e62 to your computer and use it in GitHub Desktop.
Save mbecker/fa14bfe7c7717b156c5a6c9fce2f6e62 to your computer and use it in GitHub Desktop.
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

golang/go#27238

go clean -modcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment