Skip to content

Commit 62a85ef

Browse files
committed
compiler: require go1.23 for structs.HostLayout
1 parent 59cb29e commit 62a85ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/symbol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"strings"
1313

1414
"github.com/tinygo-org/tinygo/compiler/llvmutil"
15+
"github.com/tinygo-org/tinygo/goenv"
1516
"github.com/tinygo-org/tinygo/loader"
1617
"golang.org/x/tools/go/ssa"
1718
"tinygo.org/x/go-llvm"
@@ -465,7 +466,7 @@ func (c *compilerContext) isValidWasmType(typ types.Type, site wasmSite) bool {
465466
return true
466467
}
467468
var hasHostLayout bool
468-
if c.program.ImportedPackage("structs") == nil {
469+
if !goenv.WantGoVersion(c.pkg.GoVersion(), 1, 23) {
469470
hasHostLayout = true // package structs does not exist before go1.23
470471
}
471472
for i := 0; i < typ.NumFields(); i++ {

0 commit comments

Comments
 (0)