Search code examples
gogoland

Automatically import 3rd party go packages


I was wondering if there is a way to automatically download all the imports. So let's assume I need to use github.com/gorilla/mux and several other packages in my code base. Should I manually go to my ~/go/src and run go get repo or is there a smarter way of doing dependency management. I am using Goland IDE for my development.


Solution

  • if there is a way to automatically download all the imports

    You can download all imported pkgs and their dependencies by running go get from the command line.

    I am using Goland IDE for my development

    I'm using Goland too. When imports can't be found (ie the import path is highlighted in red), you can place your typing caret over it and press alt + enter and select go get ... from the popup window to automatically import.