5 ms·
You're right that syncing directly with the net is a problem. However, the problem is basically developer education. Go doesn't work like other languages and th
by skybrian 14y ago
You're right that syncing directly with the net is a problem. However, the problem is basically developer education. Go doesn't work like other languages and the consequences aren't well-documented. If you do it right, the process works fine; it's basically how Google works internally.
The basic idea is to commit everything under $GOPATH/src so that you never need to touch the net to reproduce your build.
After running "go install" you should check in the third-party code locally, just like any other commit.
Then updating a new third-party library to sync with their trunk is like any other commit: run "go install", test your app, and then commit locally if it works. If it doesn't work, don't commit that version; either wait for them to fix it, sync to the last known good version, or patch it yourself.
If you aren't committing your dependencies then you're doing it wrong.
- eropple 14y agoAlternatively, a build system that expects me to throw away the change history of my dependencies is completely cracked. Fortunately there are alternatives (go getting a personal fork, etc.) that aren't entirely anathema to maintainable long-term development.
- tiredofcareer 14y ago> If you aren't committing your dependencies then you're doing it wrong. Disagree strongly (and hate absolutes like "doing it wrong"). Their metadata, yes, by all means, commit that. There is absolutely no reason, however, to have the source code for a dependency in my tree, Go or not. Give me a binary I can link against, or at least the temporary source in a .gitignored location, and let's call it a day. When I want to bump to a new version my commit should be a one-line version bump in a metadata file, not the entirety of the upstream changes as a commit. I've seen a sub-1MLoC project take 10 minutes just to clone. Internally! You're telling me you want to add all the LoC and flattened change history of your dependencies in your repo? Egads, no thanks! Where do you draw that line? Do you commit glibc? There's just no reason to store that history unless you are in the business of actively debugging your dependencies and fixing the problems yourself, rather than identifying the issue and rolling back to a previous version after reporting the problem upstream. I guess it's paying your engineers to fix libopenal versus paying your engineers to work on your product; one's a broken shop, the other isn't. Some people will feel it's one, some the other.
- krallin 14y agoI'm not entirely familiar with how go dependencies work, but does using git submodules for the dependencies with go make sense?
- bjeanes 14y agoAlmost. `go get` will not resolve your sub-moduled dependencies. It'll work well enough for developing your library, but will break when people try to consume your library (at least, without git cloning it)
- bjeanes 14y agoThank you. It makes me weep when I hear gophers telling me to vendor all my dependencies. That is insane. Completely insane.
- kkowalczyk 14y agoActually what is insane is to have your production code do anything else. "pip install foo" and similar schemes open your code up to the following problems: - incompatibilities that were introduced in the version 1.2.1 while you've only tested your code with 1.2 - the host is down so you can't compile your own code because your dependency is not available - the host is hacked and "foo" was replaced with "malicious foo" - exponential increase of testing (you really should test with all version of your dependencies you use) Ultimately, I don't understand the doom and gloom point of view. C, C++, Java, C# etc. programmers have been pulling dependencies in their repos for ages. In my SumatraPDF I have 12 dependencies. I certainly prefer to manually update them from time to time than to have builds that work on my machine but fail for other people or many other problems that are a result of blindly pulling third party code.
- lucian1900 14y ago> - incompatibilities that were introduced in the version 1.2.1 while you've only tested your code with 1.2 Which is why you pin dependencies to specific versions. > - the host is down so you can't compile your own code because your dependency is not available Which is why you have (caching) proxy and use mirrors. > - the host is hacked and "foo" was replaced with "malicious foo" Which is why you use GPG signing. (sadly, Python lacks in this respect). > - exponential increase of testing (you really should test with all version of your dependencies you use) Which is why you only use a specific version.