Golang, importing packages from Github requests me to remember the Github URL?
I would recommend you to read the How to Write Go Code documentation and this blog post.
The path you're seeing in your import line is not a url, but only the path the package is located in (normally relative to $GOROOT/src/pkg
or $GOPATH/src
). So your package heredoc
is most probably located in the directory $GOPATH/src/github.com/MakeNowJust/heredoc
.
The recommended way to use external packages is by downloading and installing them via go get
. You might want to check out the documentation of go get by go get --help
.
The path that import statement refers is just appended to $GOPATH/src
. So that import statement basically says "import the package located at $GOPATH/src/github.com/MakeNowJust/heredoc
"
What if later the author of the package removed it or changed the URL?
As long as you already have the source files for that package at the expected location, it should be included even if the repo has moved.