cmd/go: Program exits abruptly with the 語 character #50105
I was playing around with a simple program to see how bytes/runes work
Running it gave the expected results
Next I thought of using words from a different language for s
Did you notice what happened ? The second for loop never ran ?
Ok, next I tried to insert a fmt.Println to print random "======"
Same behavior ? So the problem lies in the first for loop
To narrow down the issue, I chose a different set of characters from the same language
This time it ran fine, second for loop executed. Hmmm
I focused on the problematic characters picking one at a time
Program worked fine for this character
Moved to the next character
Again worked fine
Which leaves the final character
And as expected the program seems to exit ? Second for loop never printed
I tried running the program on the Go playground and it seemed to work fine there
If you notice where the exit happens
It seems its coming from this line, so is %c or %x the problem here ?
I casually tried to reproduce the issue on various different online Go playgrounds (non-Google) too, by adding the line below to programs
I am also seeing the issue on below version for an online playground here (https://www.onlinegdb.com/online_go_compiler)
The text was updated successfully, but these errors were encountered:
@seankhliao In that case shouldn't the 2nd for loop at least run and print Output beginning with "Rune at byte position..." ? even if it doesn't print the actual characters ?
@zyxkad I am running Fedora on my laptop, Already gave the Go version above, Could you try this Golang online compiler here https://www.onlinegdb.com/online_go_compiler and try out the below program ? You can see that 2nd loop doesn't show all the characters either
Here is the output I see on the above Golang online playground