Golang : constant 20013 overflows byte error message
Haven't been updating the tutorials portion for a while as I was busy writing up examples for Golang bytes package. While executing the bytes.Buffer.WriteByte function example. The program exited with the error message "constant 20013 overflows byte error message".
Upon further investigation, it was caused by this line in the code
buff.WriteByte('中')
To fix this error which is attempting to write UTF8 character, simply replace WriteByte() with WriteRune() function.
buff.WriteRune('中')
Hope this will be helpful to whoever that encounter this error message.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+21.2k Golang : Randomly pick an item from a slice/array example
+4.7k Golang : Shuffle array of list
+8.5k Golang : Convert octal value to string to deal with leading zero problem
+3.7k PHP : Extract part of a string starting from the middle
+11.7k Golang : Read XML elements data with xml.CharData example
+50k Golang : How to get time in milliseconds?
+6.1k Golang : Handling Yes No Quit query input
+5.9k Golang : Rot13 and Rot5 algorithms example
+9.4k Android Studio : Create custom icons for your application example
+33k Golang : Validate IP address
+19.8k Golang : Convert(cast) string to rune and back to string example
+3.9k Golang : Constant and variable names in native language