panic: runtime error: index out of range [0] with length 0 #19
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 2 hours 30 minutes
Due date
ed
2 hours 30 minutes
No due date set.
Dependencies
No dependencies set.
Reference
cli/q#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This code gives the error : panic: runtime error: index out of range [0] with length 0
When I change the type from Color to int and use hex values it works but when I use structs it doesn't work
I'll boot up Windows and look into the details.
From the source alone I am guessing that the reasons are:
1.) "float" type isn't implemented yet but used in Vector2. (note to myself: add a proper error message)
2.) Passing structs by value to external DLL calls isn't implemented yet.
At the very least, I can confirm the following code to be working on Windows. It creates an empty window:
yes also if you use integers as colors you can clear window to any color
So probably
The
panic: runtime errorhas been fixed incli/q@aa5a28d2bfwhich now shows an error message.Currently, struct initialization as a value type must be exhaustive (all fields must be initialized) and the field names must be specified (can be out-of-order, though). I realize that sometimes developers want a short way to initialize structs, but such a method does not exist yet.
Struct value passing fixed in
cli/q@7324b97ccd.Note that this currently only works for structs up to a size of 8 bytes (1x int64).
Color has a size of 4 bytes so that works.
16 byte structs are handled differently, but I'll deal with them in a future commit.
I tried the example and it gave me a redish black

I tried to make white Color{r: 255, g: 255, b: 255, a: 255}

And I tried
Color{r: 0xFFFFFF, g: 255, b: 255, a: 255}
It seems like red channel controls everything
I'm on windows 11 intel i5 cpu
I think you might have forgotten to rebuild the compiler with
go buildafter pulling the latest git commits.mb I forgot to copy new executable to path dir
16-byte structs should theoretically work after
cli/q@4caf7e0cc9.I think we can close the issue (?) and track support for
floatin a separate one.I agree