-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: adopt Go 1.20 as bootstrap toolchain for Go 1.22 #54265
Comments
If we do this I think we should set up a builder that starts with the Go 1.4 sources and builds the current release, whatever it is, without relying on any binary build of Go. |
Bumping the bootstrap version from Go 1.17 to Go 1.20 will mean the toolchain can start using generics. That's exciting, but also a little scary because generics are still a relatively recent feature. Go 1.20 will be only the 3rd release to support generics; and switching to unified IR is going to mean a largely new implementation of them. We also don't have gofrontend support for generics yet. I'm in support of setting a tentative plan to bump Go 1.22's bootstrap toolchain to Go 1.20, so that downstream integrators can prepare for that. But I think that after the Go 1.21 release (so after a cycle's worth of Go 1.20 support), it would be good for the team to assess our confidence in depending on that release+generics for bootstrapping. That concern aside, I think a regular yearly cadence for bumping bootstrap releases sounds appealing. It means whenever we bump the bootstrap toolchain, the new version will still be within the support cycle. So maybe it's viable to actually fix bootstrap toolchain issues, rather than awkwardly skirting around them like we've had to do with Go 1.4. (And if not, the workarounds only need to live for a year anyway.) |
@ianlancetaylor I am not sure what that builder would be checking, exactly. Suppose it did:
Steps 1 and 2 will run the same code on every CL. Only step 3 will vary. And that step will match any builder that is using Go 1.20 directly for bootstrap. |
@rsc I think that would check that those steps work on the builders. I agree it wouldn't need to run every CL. Periodically, or when we change builder configs would be fine. |
Right, I didn't mean to start from 1.4 on trybots or on every CL. Sorry for being unclear. I mean an automated test, on the builders, that we can bootstrap from source with nothing but a binary C compiler. It would be fine if we just ran that test before every release. |
I'm fine with having a test that we occasionally run on some stable, backwards-compatible system like linux/amd64. I'm not sure it accomplishes much now that the build dashboard is pedantic about the specific version of Go being used for bootstrap. (In the past it was kind of random which Go bootstrap different builders had baked in. Now the dashboard is in charge of loading it onto each builder and the code is written so that they all use the specific bootstrap version.) It is certainly not a goal to have the "start with Go 1.4" sequence work on every supported operating system. Keith pointed out that Go 1.4 binaries don't work on macOS anymore, for example (I told Apple we were fine with that back when the M1 chips came out and had trouble emulating the Go 1.4 x86 binaries correctly), and other ports didn't exist back then. But a script we run occasionally on linux/amd64 sounds fine. |
Summarizing our discussion from today's compiler/runtime meeting:
|
Change https://go.dev/cl/427958 mentions this issue: |
The main rationale in my view is to do this so we don't forget how to do it. Updating to Go 1.17 was a big ordeal, and if we do it yearly, it will not be. Note also #49686 which is the kind of thing we avoid by updating quickly (here we haven't updated quickly enough, but same kind of thing). We also need to get into the habit of filing issues for completing tree-wide updates at the next bump. For example when we introduced strings.Cut we updated all the non-bootstrap-compiled code, but we should also file an issue linked to the next bootstrap update to complete the conversion of the tree then. Similarly things like strings.Builder which is going on now. |
This proposal has been added to the active column of the proposals project |
Being able to do a full source build of Go (e.g. starting from Go 1.4) without having to rely on a binary release would be required for Trusting Trust as @ken illuminated. Having support for only one major operating system/architecture target (e.g. linux/amd64) should be fine, since Go can be cross-compiled for other OS/ARCH targets. |
See also https://dwheeler.com/trusting-trust/. |
Change https://go.dev/cl/430336 mentions this issue: |
…≥ 1.20 Direct syscalls should no longer be used on darwin. Instead, directly call libc's msync when using Go ≥ 1.20 for bootstrap. For #54265 Change-Id: Ie3f1e6ccd1a06e7f0ddd88cdef5067393a69e8db Reviewed-on: https://go-review.googlesource.com/c/go/+/430336 Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Tobias Klauser <[email protected]>
Change https://go.dev/cl/430496 mentions this issue: |
CL 413374 added syscall.Mmap on solaris. Use it in cmd/compile and cmd/link if the bootstrap toolchain is Go ≥ 1.20. For #52875 For #54265 Change-Id: I9a0534bf97926eecf0c6f1f9218e855344ba158f Reviewed-on: https://go-review.googlesource.com/c/go/+/430496 Reviewed-by: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]>
When running on Go 1.19, we can further simplify some of the exec.Cmd helpers due to API improvements. There's not much point in doing this while the bootstrap is still 1.17, but this will queue up this simplification in an obvious way for when we next upgrade the bootstrap toolchain (#54265). Updates #44505. Change-Id: I2ebc3d5c584375ec862a1d48138ab134bd9b2366 Reviewed-on: https://go-review.googlesource.com/c/go/+/427958 Reviewed-by: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Austin Clements <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Based on the discussion above, this proposal seems like a likely accept. |
Just to clarify is a c build -> go 1.4 -> 1.17 -> 1.20 -> 1.22 bootstrap process included in this proposal (at least for platforms that support it) Or is this proposal just focused on bootstrapping 1.22 from a 1.20 binary? |
@nmeum Thanks. I do see how bootstrapping architectures that post-date those earlier versions of Go would be more difficult. It seems like cross-compiling would be the answer there. The unfortunate fact is that gccgo is likely to lag behind the main Go releases. |
Change https://go.dev/cl/512275 mentions this issue: |
This was missed in the update of the bootstrap toolchain and should help people who don't set GOROOT_BOOTSTRAP and instead assume these scripts will find the right one. For #54265. Change-Id: I37a0d0976006d13b73df00013780be5abf202e91 Reviewed-on: https://go-review.googlesource.com/c/go/+/512275 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Russ Cox <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
Change https://go.dev/cl/512720 mentions this issue: |
While here, also update the go15bootstrap link to use the shorter go.dev domain and https:// prefix for consistency. For #54265. Change-Id: I881eeda235589511a93bf47186f91f6c47c12932 Reviewed-on: https://go-review.googlesource.com/c/go/+/512720 Run-TryBot: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
I see that this issue remains open for the 1.24 milestone, even though as far as I can tell, the work for 1.22 happened a month ago. Is the plan to keep this a "rolling" open issue to repurpose every two Go versions? |
Yeah, but on further consideration, I don't want to. We'll track this in our internal release plan. Moved back and closing. |
Change https://go.dev/cl/562619 mentions this issue: |
So long and thanks for all the fish. See golang/go#54265
[ commit c184b82e4b323135f3e26dd2c263469a21bfa9ed ] So long and thanks for all the fish. See golang/go#54265
Fixes golang/go#65654 Updates golang/go#54265 Updates golang/go#44505 Change-Id: Ia1c9b50a2f66b67db43e8dcd21b1002b66cf30fa Reviewed-on: https://go-review.googlesource.com/c/website/+/562619 Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Austin Clements <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
Change https://go.dev/cl/609915 mentions this issue: |
Since go1.22, generic can now be used when building bootstrap toolchain. Updates #54265 Updates #64751 Change-Id: I93209fc23c92114d37ef36787ea2b520de3ed89d Reviewed-on: https://go-review.googlesource.com/c/go/+/609915 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Change https://go.dev/cl/610675 mentions this issue: |
To avoid having to maintain GO_BOOTSTRAP_VERSION in the playground Dockerfile, always use the latest "published" minor of the previous Go release as the bootstrap version, which per golang/go#54265 should always be a sufficiently recent bootstrap version. Here "published" means that the toolchain must exist, since it will be downloaded for bootstrap. To enable this, add a `-toolchain` flag to the latestgo command, which selects versions from the set of published toolchains, rather than from Gerrit tags. Fixes golang/go#69238 Change-Id: Ib4d4d7f2c0d5c4fbdccfec5d8bb83c040e0c5384 Reviewed-on: https://go-review.googlesource.com/c/playground/+/610675 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
I propose that starting with the Go 1.22 dev cycle, we require Go 1.20 as the Go bootstrap version (instead of Go 1.17),
and in general that once a year we bump the bootstrap version forward to last year's Go version.
#44505 was about updating the Go bootstrap version from Go 1.4 to Go 1.16 in Go 1.18; we were delayed and ended up updating to Go 1.17 for Go 1.20 instead. Now we have automation in place that makes it easy to update the bootstrap toolchain. To keep ourselves up-to-date and reduce the amount of technical debt we carry forward, I suggest that we establish a pattern where once a year we bump the bootstrap version forward to the previous year's Go release.
With the current release schedule, this would mean:
Go 1.22 (dev starts Aug 2023, release Feb 2024) bootstraps with Go 1.20 (released Feb 2023)
Go 1.24 (dev starts Aug 2024, release Feb 2025) bootstraps with Go 1.22 (released Feb 2024)
...
In the proposal text for #44505, I wrote about the benefits to packagers of keeping the bootstrap release fixed for longer periods of time, perhaps updating every four years. But now I am proposing that we update every one year. Why? A few reasons.
We have seen a few thorny issues, such as runtime: "sweep increased allocation count" on linux/arm64 during bootstrap #42543, caused by bugs in old toolchains being used for bootstrap; updating more frequently eliminates those kinds of bugs entirely, reducing load on the Go team.
It turned out to be a lot more work on our side to update the bootstrap toolchain than I realized when I proposed build: adopt Go 1.17 as bootstrap toolchain for Go 1.20 #44505. Clearly it needed to happen regardless, and we now have good automation in place to make the next one easy. Doing it every year will keep that process working much more smoothly than if we do every four years.
I am not sure that there is a significant burden on packagers if we have a predictable schedule: the work should be to update their bootstrap URLs once a year, perhaps after refactoring to make that an easy operation.
Thoughts? Any reasons the burden on packagers would be significantly higher than I am estimating?
The text was updated successfully, but these errors were encountered: