Skip to content

all: build/test using Go 1.27-rc1#5477

Draft
deadprogram wants to merge 4 commits into
devfrom
go1.27-ci
Draft

all: build/test using Go 1.27-rc1#5477
deadprogram wants to merge 4 commits into
devfrom
go1.27-ci

Conversation

@deadprogram

Copy link
Copy Markdown
Member

This PR is to build/test using Go 1.27-rc1

@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

Signed-off-by: deadprogram <ron@hybridgroup.com>
Go 1.27 introduced the //go:linknamestd directive, a standard-library
variant of //go:linkname that does not require importing "unsafe". The
iter package switched to it for referencing runtime.newcoro and
runtime.coroswitch, which caused "linker could not find symbol
iter.newcoro / iter.coroswitch" errors when building with Go 1.27.

Handle //go:linknamestd the same as //go:linkname, bypassing the unsafe
import requirement, and add test coverage in the pragma compiler test.

Signed-off-by: deadprogram <ron@hybridgroup.com>
@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

Signed-off-by: deadprogram <ron@hybridgroup.com>
@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

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>
@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.

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.

1 participant