robfig / glock

MIT License
230 stars 27 forks source link

Add support for multiple GOPATH workspaces #37

Closed irfansharif closed 8 years ago

irfansharif commented 8 years ago

This PR adds the necessary changes to support users with multiple GOPATH workspaces. Previously the gopath() function would truncate the system GOPATH list to only operate on the first value, as a result of this packages installed in other GOPATH workspaces were not recognized. An attempt was made to try go get .. again, this of course would not function as glock expected given the go tool chain already recognizes the packages being present in the other workspaces. Additionally if a project managed by glock is not placed under the primary workspace the GLOCKFILE is not found (given it's looking only within the primary workspace).

Concisely the changes here address both these issues, we look for the GLOCKFILE in every workspace and look for existing dependencies in the other workspaces as well. We also retain the default go tool chain behavior downloading new packages into the primary workspace (see occurrences of gopaths()[0]) all the while preserving backwards compatibility, single workspace environments should be completely unaffected by these changes.

@robfig.

robfig commented 8 years ago

Cool, thanks!