TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Principles of Versioning in Go

174 点作者 crawshaw超过 5 年前

9 条评论

nyc640超过 5 年前
I understand why this rubs some people the wrong way, but it really is consistent with Go&#x27;s vision since the start. I don&#x27;t think Russ is trying to imply that the issues they are facing when designing the language (dependency management, generics, etc.) are unique or impossible to solve in any way. I think he is simply saying that they are complex problems whose solutions introduce complexity to the language and ecosystem, and when presented with such a trade-off, the Go team has always preferred to lean towards simplicity, even if it means not implementing a feature that some (or even many) developers want&#x2F;need.<p>While I don&#x27;t personally agree with many of the decisions they&#x27;ve made, I still respect the choices they&#x27;ve made and I think there is plenty of room for languages with competing philosophies. Because of Go&#x27;s philosophy of not catering to every demand, it&#x27;s never going to become the next Java or take over all of Software Engineering, but I think the Go team is fine with that as long as it continues to be useful as a tool for solving problems.
评论 #21699070 未加载
评论 #21699291 未加载
评论 #21699885 未加载
Groxx超过 5 年前
A very large issue with go tooling around dependency management is that it&#x27;s based around concepts like this:<p>&gt;<i>If an old package and a new package have the same import path, the new package must be backwards compatible with the old package.</i><p>Which are effectively fine conceptually. Every dependency system also supports that, you just make a new project named &quot;thing-v2&quot; instead of bumping a major version. Making it explicit and encouraging it when possible (instead of forcing breaking changes) is good.<p>The problem is that there&#x27;s absolutely nothing to help you achieve that. Or detect failures to achieve it. Or anything. You can&#x27;t even reliably rename <i>a single package</i> with existing refactoring tools, good luck copying and refactoring most of an entire repository correctly. If you do it wrong, you might have to do it all over again because it&#x27;s probably another breaking change.<p>Without fairly strong tooling to push people towards correct behavior, &quot;every change is breaking&quot; is <i>the default behavior</i>. And the frequent accidental behavior even if you&#x27;re being careful.
评论 #21696335 未加载
shadowgovt超过 5 年前
Spending my time as of late in npm&#x27;s particular flavor of DLL hell, I appreciate the Go team taking a stab at this hard and persistent problem. I agree with other commenters&#x27; observations that the tooling hasn&#x27;t caught up with the philosophy, but the philosophy seems on-point (and the key observation that as the dependencies of a project approach infinity, the odds of two branches of a dependency tree wanting to rely on two different versions of the same library approach 100% and there should be a sane way to address that need... npm does a 99% decent job of addressing this, but I&#x27;ve definitely hit issues with npm where objects generated by a newer dependency version have leaked into a codepath where an older version is calling the shots, and it&#x27;s an absolute hellscape to debug).
评论 #21699332 未加载
pcwalton超过 5 年前
The basic issue with this criticism of Cargo is that the fact that updating dependencies can cause breakage <i>never actually goes away</i>. The package management tool either makes this problem easy, or it makes it hard. The approach Cargo chooses is to make &quot;cargo update&quot; more likely to work by allowing library authors to specify incompatibilities. This can go wrong in edge cases. But that&#x27;s inherent to the problem itself. Minimum version selection only seems to work because it doesn&#x27;t actually solve the problem of keeping dependencies up to date. The moment you want to do that, you&#x27;re stuck with &quot;go get -u&quot;, which is just a worse version of &quot;SAT solving&quot; because it doesn&#x27;t know how to detect and avoid incompatibilities.<p>(As an aside, I don&#x27;t like the term &quot;SAT solving&quot; for the problem of package version selection. By focusing on an implementation detail, it makes the problem seem scarier than it actually is. Register allocation is NP hard too, but nobody calls the register allocator &quot;the SAT solver&quot;.)
评论 #21696522 未加载
评论 #21696390 未加载
评论 #21696363 未加载
评论 #21696696 未加载
评论 #21696204 未加载
评论 #21696315 未加载
评论 #21700433 未加载
mfer超过 5 年前
Side note, I just noticed that <a href="https:&#x2F;&#x2F;godoc.org" rel="nofollow">https:&#x2F;&#x2F;godoc.org</a> does not support Go modules with major versions being incremented (e.g., ending in `&#x2F;v2`). The new pkg.go.dev does but not the existing godoc.org.<p>This echos some of the other observations of tooling not being easily updated and still not being there, yet.
评论 #21698622 未加载
mfer超过 5 年前
&gt; The answer is that we learned from Dep that the general Bundler&#x2F;Cargo&#x2F;Dep approach includes some decisions that make software engineering more complex and more challenging.<p>Are those documented anywhere? Are they detailed, discussed, or otherwise dealt with. The people behind those package manages have a significant amount of experience with dependency management including many real world situations. It would be good to have some public discussions on this for everyone&#x27;s benefit if this is really true.<p>&gt; Principle #1: Compatibility<p>The whole section on compatibility doesn&#x27;t sit right...<p>&gt; It is intended that programs written to the Go 1 specification will continue to compile and run correctly, unchanged, over the lifetime of that specification. Go programs that work today should continue to work even as future “point” releases of Go 1 arise (Go 1.1, Go 1.2, etc.).<p>This doesn&#x27;t seem to apply to the tooling. For example, `go get` has a new behavior since the introduction of modules. The behavior changed. So, the compatibility idea only extends so far. Is that hypocritical as an idea because people use the `go` CLI for scripting and the behavior of it changed.<p>&gt; What does compatibility have to do with versioning? It’s important to think about compatibility because the most popular approach to versioning today—semantic versioning—instead encourages incompatibility. That is, semantic versioning has the unfortunate effect of making incompatible changes seem easy.<p>Incompatible changes happen. How many long lived pieces of software have needed to make incompatible changes while supporting people through that process. Do you rewrite? Do you copy the whole codebase to a new sub-directory and add more there? This is what the Go project has started to recommend. If you do that you loose history and some projects move fast (look at Kubernetes client-go).<p>Tools like npm, cargo, and dep provide a means to stay at older versions if that&#x27;s what you want. The choice is up to the consumer of the package. With Go the choice is now up to the Go team by limiting choice. Is that a good thing? Not if you don&#x27;t like the choice.
评论 #21697035 未加载
评论 #21698022 未加载
mfer超过 5 年前
Both Red Monk and TIOBE [1] are noting a decrease in the popularity of Go. Red Monk wondered aloud if this had to do with the way the Go modules &#x2F; dep situation happened [2].<p>I wonder if the posts lately are an attempt to win people over to their thinking or to win back popularity.<p>[1] <a href="https:&#x2F;&#x2F;www.tiobe.com&#x2F;tiobe-index&#x2F;go&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.tiobe.com&#x2F;tiobe-index&#x2F;go&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;redmonk.com&#x2F;sogrady&#x2F;2019&#x2F;07&#x2F;18&#x2F;language-rankings-6-19&#x2F;" rel="nofollow">https:&#x2F;&#x2F;redmonk.com&#x2F;sogrady&#x2F;2019&#x2F;07&#x2F;18&#x2F;language-rankings-6-1...</a>
评论 #21697118 未加载
评论 #21696256 未加载
sagichmal超过 5 年前
<i>&gt; If an old package and a new package have the same import path, the new package must be backwards compatible with the old package.</i><p>Simply put, this rule is too strict, and biases modules&#x27; UX and semantics too far toward consumers.<p>Not all packages are so mature, and consumed by enough consumers, that they should be forced by the language tooling to maintain backwards compatibility. That requirement creates a great deal of pointless work for the majority, perhaps vast majority, of package authors, who write small and uncertain packages for use by themselves or a small number of their immediate colleagues. For these authors, strict backwards compatibility is not only unnecessary, it&#x27;s actually undesirable, as it creates needless toil.<p><i>&gt; The answer is that we learned from Dep that the general Bundler&#x2F;Cargo&#x2F;Dep approach includes some decisions that make software engineering more complex and more challenging.</i><p>For a minority of use cases, where packages are large and mature and imported by many, many consumers -- sure, maybe. But the vast majority of Go code, written by private organizations and used internally, doesn&#x27;t fit this description.
评论 #21697881 未加载
评论 #21697198 未加载
tandr超过 5 年前
(Kind of meta-venting out below, also known as rant.)<p>1. I don&#x27;t know why I find Russ&#x27;s writings are so irksome, even unpleasant to read, sorry. (Please help me on that, maybe I am in &quot;questioning authority&quot; mode and cannot flip out of it.) I cannot shake that feeling of being patronized all the time without being asked. The whole article, no - bunch of his posts, - reads like &quot;we know better&quot;. Is it a Google thing, or heavy Rob Pike&#x27;s influence?<p>Yes, he is bringing some good points, and some very questionable ones. And for the questionable one (Compatibility section for example, or SAT solver question (nobody did it before?), or version naming, or paths for the sub-components...) it feels like he is trying to push explanation about his (and his team?) reasons and motivations behind these decisions, but... it is a monologue. There are more opinions and whole wide world of different software shops with own ideas and practices.<p>2. Go2 was a promised land, that later translated into &quot;incremental, no code breaking&quot; approach. Nowadays it feels like they are not even talking about it anymore!<p>Looking at general history of programming languages, pretty much every language has had it&#x27;s &quot;C++&quot; or Modula-2 moments. It is a natural process - an evolution - when unneeded parts disappear, and useful ideas added&#x2F;extended. Amount of gotchas in Go is not zero, and to me (YMMV) it feels like Go2 would be (was?) a good time to shake off under-thought items, and enforce some new rules. Maybe even add interoperability between .go and .go2 files, maybe even semi-automatic upgrade path to run `go2 fmt ` on old files a la to Kotlin from Java - I don&#x27;t know. But it feels like an opportunity and momentum for a &quot;peaceful revolution&quot; is lost.<p>3. Even with non-breaking changes style of change they have managed to break stuff. I, for one, still sit on 1.12 branch - because when I tried to upgrade to 1.13 (twice now), and our pure-Go code just plainly did not build with some obscure messages (I think it was linking or module cache errors). So, why pretend? Code rot is unavoidable - do we like it or not.<p>99. There are couple more points about chilling effect of &quot;we know better&quot; on a community as whole. (One example would be this whole &quot;error&quot; debacle that visible reduced activity on issue tracker and golang-nuts mailing lists after &quot;hey all, we are going this way because we already went there&quot;. Immediately after it felt like people just gave up and left. &quot;Empty town square&quot; feeling.) It would be interesting to see this year results of &quot;the state of Go&quot; survey, but I don&#x27;t think we will see a worrisome drops there -- the amount of new people coming in would easily override any opinions of people leaving.<p>&#x2F;end of rant, sorry for a long post
评论 #21699345 未加载
评论 #21697958 未加载