tinygo
tinygo copied to clipboard
Crash when compiling with a large number of embedded files
When compiling this program with tinygo build -target wasm -o app.wasm
on macOS:
package main
import _ "cogentcore.org/core/icons"
func main() {}
The compiler crashes with this error:
panic: runtime error: slice bounds out of range [::4124] with length 1024
goroutine 1 [running]:
github.com/tinygo-org/tinygo/builder.RunTool({0x16d01938a, 0x7}, {0x140000c8020?, 0x101b?, 0x1073929dd?})
/Users/runner/work/tinygo/tinygo/builder/tools-builtin.go:31 +0x414
main.main()
/Users/runner/work/tinygo/tinygo/main.go:1486 +0xe88
error: failed to link /var/folders/pw/lntpc2cn37v41ct1t0t9t9880000gn/T/tinygo3720530408/main: exit status 2
I have determined that the reason why it is crashing is the large number of embedded files contained within https://github.com/cogentcore/core/blob/main/icons/icongen.go. If you comment out the file embedding statements from Circles
all the way to the bottom, it stops crashing, but if you uncomment enough of those lines, it starts crashing again.