更改位置时如何更新导入

I see that in Go you can import packages directly from Github like:

import "github.com/MakeNowJust/heredoc"

I understand that the path I am seeing in import line is not an URL, but only the path the package is located in (normally relative to $GOROOT/src/pkg or $GOPATH/src). So the package heredoc is most probably located in the directory $GOPATH/src/github.com/MakeNowJust/heredoc.

Now let's say that the package developer decided to migrate the code repo to Bitbucket. So now the library URL is bitbucket.com/muchMoreCoolerName/heredoc. He also added some new features to the code repo.

My question is how will you get the updated code?

The only solution I can think of is changing all the imports to new URL and doing go get again. But changing the code for library update seems a little inconvenient.

If you just use go get and then import, there is no way around it, you will have to update the import paths to get the new code. However, if you use vendoring(a technique to keep your dependency with your code and also distribute it with them) you would be isolated from that move at least until you update. When you want to update, you could use a vendor functionality to keep the old import path but to sync with the other repo.

Frankly, I'd still use vendoring in anyway and just do a search and replace for the old import path when I decide to update, this is not that hard.

EDIT You can also use dep to manage dependencies if you haven't transitioned to modules yet.