Skip to content

all: support for Go 1.27#5477

Merged
deadprogram merged 7 commits into
devfrom
go1.27-ci
Jul 14, 2026
Merged

all: support for Go 1.27#5477
deadprogram merged 7 commits into
devfrom
go1.27-ci

Conversation

@deadprogram

@deadprogram deadprogram commented Jun 25, 2026

Copy link
Copy Markdown
Member

This PR is to add support for Go 1.27

Current passes tests on 1.27-rc2

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Size difference with the dev branch:

Binary size difference
drivers/sizes-dev.txt has more commands than drivers/sizes-pr.txt
    tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
 flash                          ram
 before   after   diff          before   after   diff

@deadprogram

Copy link
Copy Markdown
Member Author

Added another commit with support for the new //go:linknamestd directive that is new in Go 1.27

@deadprogram

Copy link
Copy Markdown
Member Author

It got further. I think perhaps the new set of errors might have to do with the SSA changes for generics we were just discussing @jakebailey @aykevl

/home/runner/go/bin/tinygo test -target=wasip1 -skip='TestExtraMethods|TestParseAndBytesRoundTrip/P256/Generic|TestAsValidation' cmp compress/lzw compress/zlib container/heap container/list container/ring crypto/ecdsa crypto/elliptic crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 database/sql/driver debug/macho embed/internal/embedtest encoding encoding/ascii85 errors encoding/asn1 encoding/base32 encoding/base64 encoding/csv encoding/hex expvar go/ast go/format go/scanner go/token go/version hash hash/adler32 hash/crc64 hash/fnv html internal/itoa internal/profile math math/cmplx net/http/internal/ascii net/mail net/url os path reflect sync testing testing/iotest text/scanner unicode unicode/utf16 unicode/utf8 unique  ./tests/runtime_wasi
ok  	cmp	1.389s
ok  	compress/lzw	1.318s
panic: expected nil interface constant

goroutine 1702 [running]:
github.com/tinygo-org/tinygo/compiler.(*compilerContext).createConst(0x36af075d1320, 0x36aeff5398a0, 0x2dc853)
	/__w/tinygo/tinygo/compiler/compiler.go:3149 +0xf65
github.com/tinygo-org/tinygo/compiler.(*builder).getValue(0x36af07de0a80, {0xa0a3c8?, 0x36aeff5398a0}, 0x36af07d870e8?)
	/__w/tinygo/tinygo/compiler/compiler.go:2116 +0xb8
github.com/tinygo-org/tinygo/compiler.(*builder).createExpr(0x36af07de0a80, {0xa0a800, 0x36af07acee70})
	/__w/tinygo/tinygo/compiler/compiler.go:2202 +0x1a46
github.com/tinygo-org/tinygo/compiler.(*builder).createInstruction(0x36af07de0a80, {0xa0b388, 0x36af07acee70})
	/__w/tinygo/tinygo/compiler/compiler.go:1514 +0xd9f
github.com/tinygo-org/tinygo/compiler.(*builder).createFunction(0x36af07de0a80)
	/__w/tinygo/tinygo/compiler/compiler.go:1398 +0x4c5
github.com/tinygo-org/tinygo/compiler.(*compilerContext).createPackage(0x36af075d1320, {0x36aefb24f600?}, 0x36aef73e7d00)
	/__w/tinygo/tinygo/compiler/compiler.go:934 +0x945
github.com/tinygo-org/tinygo/compiler.CompilePackage({0x36af0baaeb00?, 0x5a?}, 0x36aef8f9ba40, 0x36aef73e7d00, {0x83f05cdfec64b02a?}, 0xdf8308?, 0xe4?)
	/__w/tinygo/tinygo/compiler/compiler.go:334 +0x445
github.com/tinygo-org/tinygo/builder.Build.func3(0x36af06bab680)
	/__w/tinygo/tinygo/builder/build.go:405 +0x1ea
github.com/tinygo-org/tinygo/builder.runJob(0x36af06bab680, 0x36aefd3efdc0)
	/__w/tinygo/tinygo/builder/jobs.go:212 +0x4d
created by github.com/tinygo-org/tinygo/builder.runJobs in goroutine 1582
	/__w/tinygo/tinygo/builder/jobs.go:113 +0x6c9
make: *** [GNUmakefile:533: tinygo-test-wasip1-fast] Error 2

@deadprogram

Copy link
Copy Markdown
Member Author

Added another commit that updates x/tools to a newer version that handles the new generics changes. The consequence of this is that the new minimum version of Go for TinyGo is 1.25, which is something that we also discussed in the monthly meeting.

@jakebailey

Copy link
Copy Markdown
Member

For Windows, seems like you need the chkstk.S change for more platforms.

I think TestBuild/EmulatedCortexM3 is unavoidable, new json v2 is just larger.

@jakebailey

Copy link
Copy Markdown
Member

I think I actually have all of the other failures figured out, but, not sure what to do with the fixes.

One or two of them I can send to dev first. E.g. when I added recover support, I totally forgot to also enable FailNow and SkipNow, and that's what some of the failure is.

Comment thread src/runtime/runtime_windows_go126.go Outdated
@deadprogram deadprogram changed the title all: build/test using Go 1.27-rc1 all: build/test using Go 1.27-rc2 Jul 8, 2026
Comment thread builder/builtins.go Outdated
@jakebailey jakebailey force-pushed the go1.27-ci branch 3 times, most recently from cfcf9cd to db17b48 Compare July 8, 2026 17:47
@deadprogram

Copy link
Copy Markdown
Member Author

@jakebailey I just overwrote your commits that you had already added to this branch by force puching without having pulled your changes to my local branch first. Sorry about that, my bad :(

Can you help get them back in please?

@jakebailey

Copy link
Copy Markdown
Member

I don't have the ability to for a few days but you can download these and git apply them

@deadprogram

Copy link
Copy Markdown
Member Author

@jakebailey thanks! Just ammended this PR with those 2 commits...

@deadprogram

Copy link
Copy Markdown
Member Author

Looks like the test failures so far are perhaps related to crypto/ecdsa.

@jakebailey

Copy link
Copy Markdown
Member

Yeah, I couldn't figure those out as they did not reproduce locally

@deadprogram

Copy link
Copy Markdown
Member Author

Actually it seems like it was compress/flate. Skipping for now to see if other tests pass.

@jakebailey

Copy link
Copy Markdown
Member

That last commit reminds me of #5508

@deadprogram

Copy link
Copy Markdown
Member Author

That last commit reminds me of #5508

Indeed, it looks like #5508 is a better version of the same idea.

@deadprogram

deadprogram commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

#5508 was merged, then I removed my commit from this branch and rebased in the latest dev

@deadprogram

Copy link
Copy Markdown
Member Author

Looks like I needed a version of that commit after all to handle the float32/float64 difference.

@deadprogram deadprogram marked this pull request as ready for review July 11, 2026 20:29
@deadprogram deadprogram changed the title all: support for Go 1.27-rc2 all: support for Go 1.27 Jul 12, 2026
@deadprogram

Copy link
Copy Markdown
Member Author

I have moved 2 of the commits in the PR into #5514 and #5515 so they can be merged sooner and to cleanup the commits in this PR.

@deadprogram

Copy link
Copy Markdown
Member Author

Cleaned up commits a bit and also rebased against dev.

#5514 was merged, #5515 is still pending feedback so I left it in this PR still so tests could pass.

@deadprogram

Copy link
Copy Markdown
Member Author

I removed the commit from #5515 and replaced with the commits from #5519 since it passed for me locally. Now running CI...

@deadprogram

Copy link
Copy Markdown
Member Author

Rebased now that #5519 has been merged into dev

@deadprogram

Copy link
Copy Markdown
Member Author

I think we should open an issue for each of the tests that we needed to skip so we do not lose track of them, and then we should squash/merge the rest of this PR since 1.27 is nearly here.

Any thoughts on this?

@jakebailey

Copy link
Copy Markdown
Member

I'm already looking into some of them, but issues would be nice of course; they're definitely not things that are blockers given they don't affect 1.26

@deadprogram

Copy link
Copy Markdown
Member Author

@jakebailey does that mean you are in favor of merge? Other people, also please provide feedback.

Comment thread src/runtime/os_darwin_go126.go Outdated
@jakebailey

Copy link
Copy Markdown
Member

Yes; the issue with compress/flate is a large value type, but that's not a new tinygo problem, just something new in Go 1.27's code (https://go.dev/cl/707355). Fixing that is turning into quite a horrorshow. I have not looked into the crypto/ecdsa Wasm problem yet.

But in any case, I don't think that this means this PR is incomplete.

Signed-off-by: deadprogram <ron@hybridgroup.com>
deadprogram and others added 6 commits July 14, 2026 09:51
Signed-off-by: deadprogram <ron@hybridgroup.com>
Go 1.27 adds generic methods (golang/go#77273). golang.org/x/tools
go/ssa v0.42.0 does not instantiate them: objectMethod only applies
receiverTypeArgs and ignores method-level type parameters, so a call
such as (*math/rand/v2.Rand).N resolves to the abstract generic method
and its body reaches createConst with a type-parameter-typed zero
constant, triggering "panic: expected nil interface constant".

Upgrade golang.org/x/tools to v0.47.0, whose go/ssa returns nil from
MethodValue for generic methods and instantiates method-level type
parameters. No compiler changes are required.

Since x/tools v0.47.0 requires Go 1.25, raise the minimum supported Go
version from 1.24 to 1.25.

Signed-off-by: deadprogram <ron@hybridgroup.com>
Go 1.27 packages can emit stack probes on Windows amd64 and arm64.
Link the compiler-rt stack probe builtins and use compiler-rt for those
targets so these packages build.
Go 1.27 jsonv2 pushes testdata/json.go beyond the LM3S6965 flash
budget. Keep coverage on larger emulated targets while skipping only the
too-small Cortex-M QEMU configuration.
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
@deadprogram

Copy link
Copy Markdown
Member Author

I have rebased the commits into the most atomic set I can detemine. Leaving the commits to skip tests to provide a more specific trail for us to restore those tests when we are able instead of just creating issues.

Thank you very much for all your help to get this done @jakebailey

Waiting for CI to complete, then will merge...

@jakebailey

Copy link
Copy Markdown
Member

The Wasi issue is just Goexit not working on Wasm, so that just has to be skipped until Wasm in general supports panic/recover properly.

@deadprogram

Copy link
Copy Markdown
Member Author

The Wasi issue is just Goexit not working on Wasm, so that just has to be skipped until Wasm in general supports panic/recover properly.

OK, that makes sense. There is already #4380 for when that occurs.

@deadprogram deadprogram merged commit 801bd48 into dev Jul 14, 2026
26 checks passed
@deadprogram deadprogram deleted the go1.27-ci branch July 14, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants