Skip to content
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

add support for Go 1.23 #871

Merged
merged 13 commits into from
Sep 4, 2024
Merged

add support for Go 1.23 #871

merged 13 commits into from
Sep 4, 2024

Conversation

mvdan
Copy link
Member

@mvdan mvdan commented Aug 31, 2024

(see commit messages - please do not squash)

Fixes #859.
Updates #859.

mvdan added 8 commits August 31, 2024 00:43
This teaches the program how to collect information from multiple
Go versions and join it together. For this to work, it needs to
select the Go versions itself, which is now possible via GOTOOLCHAIN.

The merging of data is fairly simple; we join the results from all
versions, and we remove duplicates from older Go versions.

Start producing output with the Go version noted on every data point,
so that we can easily scan what each Go version is contributing.
Rebasing the Go 1.22 patches on top of Go 1.23.0,
as published on burrowers/go-patches#7.

Updates burrowers#859.
In particular, x/tools so that we get a newer go/ssa version
with support for the latest language features such as range over func.

Updates burrowers#859.
As of Go 1.23, these are forbidden by https://go.dev/issue/67401.

Updates burrowers#859.
And update some actions and staticcheck while here.

Drop the testing of Go master as well, as I haven't used or maintained
such a setup for a while now. We can simply add Go 1.24 RC versions
to the go-version matrix once they come out.

Fixes burrowers#859.
mvdan added 2 commits August 31, 2024 23:40
Since some packages are in some Go versions but not others.
We had a version of this check when we last supported two Go versions.
Recently, a patch changed the argument `-mod=` to `-mod=readonly`
as the former is not really a valid flag value, and broke with go.work.
However, the latter seems to break our tests on Go 1.22.6
when listing all of runtimeLinknamed:

    panic: failed to load missing runtime-linknamed packages: golang.org/x/[email protected]:
        reading http://127.0.0.1:43357/mod/golang.org/x/crypto/@v/v0.16.1-0.20231129163542-152cdb1503eb.mod: 404 Not Found

It seems like, somehow, listing std packages was trying to download
x/crypto from GOPROXY - which is a local server with testdata/mod,
and so it does not contain x/crypto. However, this is entirely wrong,
as std vendors dependencies, including this very version of x/crypto.

Reverting the change to `-mod=readonly` resolves this issue,
which explains why we hadn't encountered this surprising GOPROXY error,
but the revert would also break users of go.work files.
Luckily, we have a better alternative: rather than trying to override
the value of the flags by adding more arguments, delete them entirely.
@mvdan mvdan requested review from capnspacehook, lu4p and pagran August 31, 2024 22:49
@mvdan
Copy link
Member Author

mvdan commented Aug 31, 2024

It took some head banging, but I figured out the last bug. FYI this should be ready to review. Apologies that there are a number of changes, but I tried to split up every necessary change along the way for the sake of the reviewer.

@mvdan mvdan mentioned this pull request Aug 31, 2024
Otherwise we miscalculate int sizes, type sizes, alignments, and so on.
Caught by the GOARCH=386 go test on CI, since the os package imports
internal/syscall/unix, which uses arch-dependent padding.

The different padding between our incorrect use of go/types
and the correct typechecking done by the compiler caused different
obfuscation of fields, as the struct types stringified differently,
and they are used as a hash salt for field name obfuscation.
@mvdan
Copy link
Member Author

mvdan commented Aug 31, 2024

OK, spotted yet another bug. This time, we hadn't been correctly computing type sizes at all, at any point in the past. I guess we were lucky that it never caused issues.

In particular, wireguard had Go runtime hacks that broke with Go 1.23,
and the latest master version resolves this issue.
@mvdan
Copy link
Member Author

mvdan commented Sep 3, 2024

Green at last!

@mvdan
Copy link
Member Author

mvdan commented Sep 4, 2024

Given how Go 1.23.0 came out a few weeks ago, and many users of Garble are waiting for this, and it passes CI and it seems correct as far as I'm aware, I'm going to merge as-is without reviews. Any late reviews or post-merge changes via PRs are of course welcome; I just don't want to let these patches sit here for longer.

@mvdan mvdan merged commit 324c1d5 into burrowers:master Sep 4, 2024
7 checks passed
@mvdan mvdan deleted the more-go1.23 branch September 4, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support for Go 1.23
1 participant