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
+7.2k Golang : Get environment variable
+21.7k Golang : Encrypt and decrypt data with TripleDES
+24k Golang : Call function from another package
+17.8k Golang : Iterate linked list example
+27.6k Golang : dial tcp: too many colons in address
+17k Golang : How to save log messages to file?
+8.3k Prevent Write failed: Broken pipe problem during ssh session with screen command
+12.5k Golang : Forwarding a local port to a remote server example
+8.5k Golang : Generate Datamatrix barcode
+13.7k Golang : Set image canvas or background to transparent
+36.7k Golang : Display float in 2 decimal points and rounding up or down