3 ms·
I actually think the go solution to this problem is quite elegant (because it also encapsulates info on where the dependencies come from), and preferable to oth
by grey-area 14y ago
I actually think the go solution to this problem is quite elegant (because it also encapsulates info on where the dependencies come from), and preferable to other package systems which have one point of failure or central package repository.
If you want to roll your own mirror simply change github.com/foo to my mirror.com/foo in your code. At least then you document the expected dependency with the code itself and can remove it if required. It also lets you very easily import a local package instead if you prefer. If the maintainer changes the location of their package and you have not taken a copy you might have to change your code, but this happens very rarely in my experience and isn't a big issue.
Go doesn't have versioning for packages yet, and they will need to add this, but that wouldn't be hard to add as an option to the current import scheme.
- niggler 14y ago"If you want to roll your own mirror simply change github.com/foo to my mirror.com/foo in your code" This is very messy. If a mirror changes, you have to go back through all of your source code and change all of the relevant imports. I personally find the node.js/npm solution to the problem (separate the dependency mapping for external resources, allow changes to those without having to modify the source) to be more useful. It lets you swap local and remote versions effortlessly and, using a private npm server, maintain packages for a large internal network.
- grey-area 14y agoThis is very messy. If a mirror changes, you have to go back through all of your source code and change all of the relevant imports. Have you run into real-life problems with this or is it more a hypothetical issue? You can use local package import paths instead if you prefer to manage your dependencies separately (and have several different goroots too with different sets of packages), or use DNS/hosts to manage where your private package server domain points, there are lots of options which don't require specification of a package server in one place.
- BarkMore 14y ago"If you want to roll your own mirror simply change github.com/foo to my mirror.com/foo in your code" Instead of changing the code, use a version control command to clone your repository mirror to your workspace.