7 ms·
I have misgivings about all this version pinning. At first, it seems to make things easier. Programs don't break because some imported package changed. So it l
by Animats 9y ago
I have misgivings about all this version pinning. At first, it seems to make things easier. Programs don't break because some imported package changed. So it looks like a win. At first.
Over time, though, version pinning builds up technical debt. You have software locked to old unmaintained versions of packages. If you later try to bring some package up to date, it can break the fragile lace of dependencies locked in through past version pin decisions.
Some version pinning systems let you import multiple versions of the same package into the same build to accommodate dependencies on different version. That bloats executable code and may cause problems with multiple copies of the same data.
On the other side, once package users are using version pinning, it's easier for package maintainers to make changes that aren't backwards compatible. This makes it harder for package users to upgrade to the new package and catch up. Three years after you start version pinning, it's going to be a major effort to clean up the mess.
The Go crowd tries to avoid churn. Their language and libraries don't change too much. That's a good, practical decision. Go should reject version pinning as incompatible with the goals of Go.
- condescendence 9y agoTechnical debt is definitely something to worry about, however I think most companies' first priority is a working product. Technical debt is to be handled during the development cycle, not in source code and most of the issues you bring up (bloated software, version pinning) are solved in build systems and again should not be handled by source code. Anyone working in an enterprise enviorment, especially that has clients on different systems, would instantly crumble without being able to target specfic builds. Legacy and long term support software is everything. >Go should reject version pinning as incompatible with the goals of Go. This would instantly make go a 'no-go' in any enterprise enviorment.
- rsc 9y agoWe do reject version pinning. There is no way to pin a particular version. The only constraint you can express is ">= this specific version". If nothing else pushes it forward, though, you'll keep getting that specific version. But it's not pinning, it's just stating a minimum, and the system uses the single oldest version that satisfies all the stated minimums (the max of the mins).
- avar 9y agoIf you have no way to do pinning, how do you e.g. reproduce a bug or issue with a specific set of older dependencies?
- rogpeppe1 9y agoYou can specify that a given dependency be replaced by another one. That only applies at the top level though, not when the go.mod file with the replace clause is used by another module.
- bpicolo 9y agoThat seems like it only works well if library authors are both extremely well behaved and also don't make mistakes, and there's no way that will be universally true. Every time I've had to pin a version it's because a backwards incompatibility issue or more likely just a bug is, intentionally or not, added to a library. It's going to be much more painful if people have to fork when a bug is introduced lest they have to wait a week or more to get a bugfix upstreamed.
- joncalhoun 9y agoI think you misunderstood what was said. In this proposal, each of your modules specifies a minimum version, but when code is built it tries to use the minimal version that meets those requirements. Eg I might have my module that says: "some/pkg" v1.4.1 Which means I need at least version 1.4.1. When the code builds it will try to use 1.4.1 EVEN IF 1.4.2 EXISTS, unless it is forced to use 1.4.2 by another module you depend on. That is, say you are using module X and it says: "some/pkg" v1.4.2 At this point 1.4.1 cannot be used - module x, which you are using, won't work with 1.4.1 - so pinning doesn't help. Your code will not build unless you manually update your pinned version. What the minimal version selection does is say "okay one module needs >=1.4.1, another needs >=1.4.2. What is the minimal version that satisfies these requirements?" And the answer to that is `1.4.2`, so even if 1.4.8 exists, 1.4.2 is used in that scenario. I don't know how this will work long term. I think there are definitely some concerns to consider (eg many minor version bumps are for security fixes), but the scenario you are describing - the newer version causing issues - just isn't an issue as I understand it because your code won't opt to use a newer version unless you (or another module you use) explicitly tell it to.
- cortesoft 9y agoI am pretty sure this is exactly the problem semantic versioning is trying to solve. You only pin to the major version, which is supposed to ensure no breaking change occurs.
- Jach 9y agoBut it just delays the problem and introduces new ones... Patch changes, don't care, minor changes, don't care, major changes, you're screwed [maybe]. https://www.youtube.com/watch?v=oyLBGkS5ICk https://www.youtube.com/watch?v=oyLBGkS5ICk (https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/Spec_ulation.md https://github.com/matthiasn/talk-transcripts/blob/master/Hi...)
- mjevans 9y agoDon't think of it as /version/ pinning. Think of it as Interface / API pinning. A //public library// should have a well thought out interface that works at least for one project and preferably for several different projects. If the interface needs to change I agree with the recommended semantics of planning what that change should look like and creating a new named interface (API) for that specification. Since go expects everything to build against the 'latest' version of an interface, it should be obvious what's wrong if a stale cached version is in use. Thus /expanding/ an interface / API is permissible. They should be thought of as /write only/.
- dragonwriter 9y ago> Over time, though, version pinning builds up technical debt. Version pinning does not. Misusing it might, but don't do that. Version pinning of dependencies is a tool for assuring the behavior of releases, but in development you should be generally be updating to the latest stable version of dependencies and then pinning them for the next release, not keeping the old pinned versions.
- zbentley 9y ago> Misuisng it might, but don't do that. Isn't technical debt usually just the situation of having many things that should be done, but aren't? In other words, the accumulation of "don't do that" cases in code.
- dragonwriter 9y ago> Isn't technical debt usually just the situation of having many things that should be done, but aren't? Sure, the things that you shouldn't do are the things that lead to technical debt. What I'm saying is that "version pinning to assure consistent behavior in stable releases" is not one of those things. What is one of those things is "leaving pins from the last release in place in development". Version pinning in releases is a means of providing stability for downstream users. It should be encouraged. Leaving those pins in place while developing the next version is a source of technical debt. It should be discouraged.
- deleted 9y ago[deleted]
- thrownaway954 9y agopersonally this is the main reason I have avoided go from the beginning. without being able to specify a version of the library I want to use, whose to say that the next time I try to run my program it might use a newer version of a library and not run. If that happens there was no easy way around it other than digging into the code and fixing the problem.
- jdoliner 9y agoSince Go is compiled and statically linked there's no way that library version can change between runs of your program. It can change between compilations of your program though, the standard go solution to that is vendoring code which will guarantee that it's always the same code getting compiled. This is not without its issues, but I find it to be a pretty usable system, just smart enough to get what I need done. To be fair though, vendoring didn't exist in the beginning of go, so this was a perfectly good reason to avoid it then.
- pjmlp 9y agoGo stopped being statically linked a couple of versions ago. Yes, by default it uses statically linking, however generating dynamically linked binaries and libraries is also an option.
- treve 9y agoBeing able to create consistent builds seems more important to me than being forced to fix builds because random packages changed their API. You're right that it is technical debt to not be on the latest version, but if I need to roll back to a previous (of my application) version due to a regression, I want to be 100% sure I get the exact same state as I did before. If my dependency management software doesn't solve this, it's not good enough.
- stickfigure 9y agoThis is horrible advice. I work in a lot of languages (including Go), which gives me some perspective. On the extreme ends of this issue we have Maven, which specifies hard version numbers (fuzzing is possible but culturally taboo) and NPM, which only recently acquired the ability to lock version numbers and still has a strong culture of "always grab latest". The Maven approach is unquestionably superior; code always builds every time. If you walk away from an NPM build for nine months, the chance that it will build (let alone work as before) is vanishingly small. I waste stupid amounts of time fighting with upstream dependencies rather than delivering business value. People break library interfaces, that's just a fact of life. The only question is whether they will break your code when you explicitly decide to bump a version, or when randomly when someone (possibly not even you) makes changes to other parts of the system.
- baq 9y agoLock files are best of both worlds: you specify the latest at check in time and then freeze whatever was picked. No need to reinvent the world.
- abvdasker 9y agoYeah it's crazy that there's still so much controversy around this topic considering Node and Ruby have had amazing dependency management for over half a decade at this point. Dependency management in those languages is pretty much a solved problem and the fact that go isn't there yet drives me nuts since I have to work with it every day for my job.
- munificent 9y agoWell, the ways Node and Ruby "solve" this is are almost diametrically opposed, so I don't think it makes sense to call this a solved problem.
- rhizome 9y agoIndeed this thread has caused me to retreat back into my Ruby hole. Seems like any contemporary solutions should be at least as good as a Gemfile/.lock.
- shkkmo 9y agoJust because you don't need reproducible builds doesn't mean nobody needs them. As soon as some tool is used to provide reproducible builds, you have effective version pinning. If your organization values avoiding technical debt accumulation over reproducable builds, they don't don't have to use version pinning and can always run 'go get' with the '-u' flag. > once package users are using version pinning, it's easier for package maintainers to make changes that aren't backwards compatible. I don't think ease of making backwards incompatible changes with vgo. Both before and after vgo, backwards incompatible changes must go in a new major version / new import path. The ability to pin major versions already exists.
- 0xdeadbeefbabe 9y agoAlthough no one talks about it you don't have to use go get. I don't know if that's bad or not, but at least two projects are doing it.
- codedokode 9y ago> Over time, though, version pinning builds up technical debt. You have software locked to old unmaintained versions of packages. If you are talking about open source, it is not a problem: anyone can upgrade dependencies and make a pull request. Without version pinning, the project will always be in a "broken" state. For example, recently I tried to run Firefox 3.5 on linux and it crashed with modern versions of gobject libraries although they are supposed to be backwards-compatible. I wish Debian package manager allowed to install an old version of a library specially for this application.