How does Go update third-party packages?

Looking how actively golang packages grow and improve I wonder how the problem with package versions is solved?

I see that one way is to store third-party packages under a project folder.

But what if I install it with go get ?

1 Like

go get will install the package in the first directory listed at GOPATH (an environment variable which might contain a colon separated list of directories). You can use go get -u to update existing packages.

You can also use go get -u all to update all packages in your GOPATH

For larger projects, it might be reasonable to create different GOPATHs for each project, so that updating a library in project A wont cause issues in project B.

Type go help gopath to find out more about the GOPATH environment variable.

Refer: stackoverflow.com