Managing GoLang dependencies in separate projects

I had issues on how to separate dependencies in totally different projects using GoLang. i.e. If I update one global(user-local) dependency in a GoLang project - how do I ensure that the other projects won't break and won't require any change when a dependency is updated.

For example, I might have projects like this:

/client1/proj1/goapp/...

/client2/proj2/goapp/...

I surely do not want proj1 and proj2 dependencies to be the same. And as seen in the path structure, goapp is a part of a larger project

How do i fix this?

A way to do so is to set different GOPATH for different projects.

But GOPATH can be a list of multiple paths - we want to make sure that we use project paths only. The dependency installation with go get installs in the global(user-local) paths by default. This default behavior can lead to undesired outcomes.

Why not just use vendor directory instead?

The vendor directory dictates that the code is placed under $GOPATH/src

If you are okay with adding new project directories to global GOPATH and comfortable with the directory structure it dictates - you could fetch a specific revision of a dependency with govendor and not use the boilerplate below