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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Reproducible Builds in Go

233 点作者 Spiritus大约 10 年前

21 条评论

davecheney大约 10 年前
Hi HN,<p>There was a video recorded at this meetup, but I&#x27;m not in control of that.<p>In the mean time, the getting started document [1] is the contents of the &quot;demo time&quot; slide.<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;constabulary&#x2F;gb&#x2F;blob&#x2F;master&#x2F;getting-started.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;constabulary&#x2F;gb&#x2F;blob&#x2F;master&#x2F;getting-start...</a>
评论 #9457872 未加载
评论 #9459451 未加载
ghodss大约 10 年前
One major limitation of this approach is that any project that wishes to vendor or lock their dependencies can no longer be used as a dependency for another project. From the gb GitHub:<p>&gt; A project is the consumer of your own source code, and possibly dependencies that your code consumes; nothing consumes the code from a project.<p>This seems to imply that any code <i>outside</i> of a project (i.e. the code inside vendor&#x2F;src) has no recourse for indicating the versions of their dependencies. This is nice in that it simplifies the problem, but to completely remove the ability for any and all libraries to indicate the versions of their dependencies seems unnecessarily restrictive. If I build a library for others to use, and I have a dependency, I want to be be able to lock to a specific version, or at least give my preference for a version.<p>Of course, this creates its own issues - what do you do when two libraries depend on two different versions of the same library? (Also known as the diamond dependency problem.) This is where the Go culture helps, where as long as you pick a later version, things are likely to work. But I&#x27;d rather have the tooling let me detect the two versions that the two libraries want, show that there is a mismatch, and give me the ability to override and pick one (probably the later one). Instead, the gb approach eliminates the ability for the libraries to even have the ability to indicate what version they would prefer, which makes it even more difficult to get a bunch of libraries that share dependencies to work correctly together.<p>godep (<a href="https:&#x2F;&#x2F;github.com&#x2F;tools&#x2F;godep" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tools&#x2F;godep</a>) seems to have the best compromise: vendor dependencies without path rewriting (though with GOPATH rewriting), but also keep track of their versions in a Godep.json file. You can gracefully pick between conflicting versions upstream if need be.
评论 #9463128 未加载
评论 #9459656 未加载
endymi0n大约 10 年前
Sad to say so, but this really makes a lot of sense - and it&#x27;s dead simple, something I really appreciate as a Gopher.<p>Suddenly you&#x27;re able to have full control over a project, use private repos effortlessly (even with SSH protocol) and most importantly for me, not check in all the dependencies and their changes like with Godep, which just keeps up messing up the history although having nothing to do with the project.<p>Just Git submodules and you&#x27;re done.
评论 #9457121 未加载
评论 #9459694 未加载
cakoose大约 10 年前
On slide 9 it says that enhancing the syntax for &quot;import&quot; would be a backwards-incompatible syntax change. Sure, old compilers wouldn&#x27;t accept newer code, but newer compilers would accept old code without breaking the behavior.<p>Is Go&#x27;s definition of &quot;backwards compatible&quot; different from the usual one?
评论 #9459517 未加载
评论 #9457124 未加载
YZF大约 10 年前
The link isn&#x27;t working for me.<p>What we do is keep a copy of all packages we use and then assemble everything into a workspace as part of the automated build. Nothing is pulled from GitHub at build time. All those copies are versioned so you can have different projects use different versions. The dependencies are specified via some pre-existing build infrastructure but essentially there is one file in the project listing all the dependencies and where to find the packages.<p>Developers can still have their own personal workspace and build with different versions but the &quot;real&quot; build is always reproducible.<p>I think many people using Go or wanting to use Go in commercial&#x2F;production environments are finding a little bit of impedance mismatch between the Go view of the world (the workspace and packages) and what their existing tooling does. It&#x27;s not too terrible to deal with but it would be nice if we had a little more flexibility. go get could support some nicer&#x2F;automated version of the above where you have the ability to download&#x2F;mirror packages to a shared drive or to another source control system and pull from there to your workspace based on specific dependency versions. This is fairly minor friction though.
Aissen大约 10 年前
Got my hopes up for deterministic builds, but then I read on slide 5:<p><pre><code> Out of scope: compiler doesn&#x27;t produce byte for byte comparable binaries</code></pre>
评论 #9457558 未加载
AnkhMorporkian大约 10 年前
I love the presentation, but the GIL problem and Go&#x27;s package problems aren&#x27;t really even comparable. The GIL is an unfortunate consequence of the CPython implementation that can&#x27;t really be solved without some serious hacks or computationally expensive workarounds. The Go &quot;problem&quot; is almost entirely an implementation problem; something evidenced by a simple fixed implementation.<p>Honestly, the entire presentation was nearly lost on me by the weird comparison at the beginning. I recovered, but seriously, very strange comparison for anyone who understands what the GIL represents.<p>Edit: And really, was github the best target to go to for availability when it came to developer downtime on the edited XKCD? Github&#x27;s downtime is pretty near 0. I think I remember roughly an hour of downtime in 2014 in the super early morning, and nothing before that until 2012 maybe.
评论 #9457412 未加载
评论 #9457299 未加载
评论 #9457365 未加载
评论 #9457533 未加载
评论 #9457130 未加载
vanmount大约 10 年前
I&#x27;m very excited about GB. GVM made working on multiple projects already a lot easier, but dependencies are still a huge pain... I don&#x27;t know if GB is the best answer to the problem, but at least it&#x27;s a big step forward and I&#x27;ll definitely try it out.
eternalban大约 10 年前
Go would hugely benefit from a hierarchical &#x2F;.go in $GOPATH. This would allow for a robust versioning scheme, and allow the language to scale in the future.
评论 #9457800 未加载
iddqd大约 10 年前
I think I&#x27;ll stick to using submodules and a Makefile with GOPATH set to the vendor directory. Hasn&#x27;t failed me yet.
tshannon大约 10 年前
Might be overkill, but for my large projects, I simply host my own gogs [1] instance and vendor in all my dependencies to that instance. I get reproducible builds, and I can bring in any updates I want manually when I&#x27;m ready for me.<p>1.<a href="http:&#x2F;&#x2F;gogs.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;gogs.io&#x2F;</a>
humanfromearth大约 10 年前
TL;DR: Don&#x27;t use `go get` if you want reproducible builds.<p>It&#x27;s early for me to tell, but looks like gb is something like a mix between a gvm (virtual env) and godep (vendorizing).<p>I&#x27;m skeptical about things like &quot;don&#x27;t use the standard, use my thing&quot;, but I will try it anyway.
评论 #9457062 未加载
caiusdurling大约 10 年前
Reminds me of developing rails apps way back in the day before RVM gemsets or bundler came along. You&#x27;d vendor all the gems (&amp; specific version for your app) into `vendor&#x2F;gems` ala <a href="http:&#x2F;&#x2F;nubyonrails.com&#x2F;articles&#x2F;2005&#x2F;12&#x2F;22&#x2F;freeze-other-gems-to-rails-lib-directory" rel="nofollow">http:&#x2F;&#x2F;nubyonrails.com&#x2F;articles&#x2F;2005&#x2F;12&#x2F;22&#x2F;freeze-other-gems...</a>
评论 #9457430 未加载
shocks大约 10 年前
It&#x27;d be nice if we could somehow use semver. I&#x27;d like to get patches automatically...<p>edit; if you downvoted, maybe comment and explain why?
drewolson大约 10 年前
How is this different from godep[1] other than being the root of its own GOPATH and having a different naming convention for the location of vendored dependencies?<p>[1] - <a href="https:&#x2F;&#x2F;github.com&#x2F;tools&#x2F;godep" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tools&#x2F;godep</a>
humanfromearth大约 10 年前
@davecheney<p>Thanks for your work.<p>If I publish my project on github and use gb with it, then people who want to contribute have to install gb as well.<p>Do you think that in the future there is a chance to do the building of a gb project without the gb itself?
评论 #9457686 未加载
评论 #9457684 未加载
stormbrew大约 10 年前
If you&#x27;re going to vendor everything anyways, I don&#x27;t really see why you need a new tool. But IANAG, so maybe I missed something?
评论 #9457287 未加载
aikah大约 10 年前
Yet another problem the go team refuses to see. Either the go team says &quot;not our problem&quot; then people are stuck with doing things multiple and incompatibles ways , or the go team says &quot;we already solve the problem, vendoring&quot; and the go team doesnt understand the problem at first place. That&#x27;s the recurrent pattern with the Go team. Everything cannot be dealt with in userland, or you&#x27;ll end up with fragmentation. And No , vendoring doesn&#x27;t solve the problem.
评论 #9457541 未加载
评论 #9457513 未加载
pas256大约 10 年前
The number of parallels between Go and Ruby keeps me entertained. Isn&#x27;t this just rvm and bundler all over again?
评论 #9461465 未加载
ahmetmsft大约 10 年前
Can somebody please share a mirror? App Engine instance seems like it has exceeded the quota. (lol)
GutenYe大约 10 年前
yet another try......
评论 #9457403 未加载
评论 #9457303 未加载