Apply it to an old project
You have an existing project, and want to start using go modules? Run the following command, and you’re almost done:
go mod init github.com/name/repo
The last argument, is the importable path to the directory you’re working from.
If you are already using godep, you won’t need to do anything. The versions you specified prior, are copied over from your Godep files. All that’s left to do, is to delete the old Godeps.* files once the command is done.
When you’re starting from scratch
If you haven’t been using Godep on an old project, or are starting a new Go project and would like to use modules, all you need is a single command.
After the mod init command like above, you can use go get to add dependencies to the project, and have the module remember their exact version.
https://vsupalov.com/switch-to-go-modules/
https://github.com/tools/godep
https://vsupalov.com/switch-to-go-modules/
https://blog.golang.org/migrating-to-go-modules
https://www.cnblogs.com/Dominic-Ji/articles/11660040.html
https://juejin.im/post/5c7fc2b1f265da2dac4575fc
https://tonybai.com/2014/10/30/a-hole-of-godep/
https://rollout.io/blog/godep-dependency-management-in-golang/
go get github.com/tools/godep
godep save
https://github.com/tools/godep/issues/437
https://github.com/tools/godep/issues/433
godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
godep: WARNING: Go version (go1.13) & $GO15VENDOREXPERIMENT= wants to enable the vendor experiment, but disabling because a Godep workspace (Godeps/_workspace) exists
godep: Unable to parse Godeps: read Godeps: is a directory
$export GO15VENDOREXPERIMENT=0
$godep save ./…
godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
godep: WARNING: Go version (go1.13) & $GO15VENDOREXPERIMENT=0 wants to enable the vendor experiment, but disabling because a Godep workspace (Godeps/_workspace) exists
godep: Unable to parse Godeps: read Godeps: is a directory