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
+31.9k Golang : Convert []string to []byte examples
+6.7k Golang : How to setup a disk space used monitoring service with Telegram bot
+16.2k Golang : How to implement two-factor authentication?
+11k Golang : How to pipe input data to executing child process?
+12.3k Golang : HTTP response JSON encoded data
+18.5k Golang : Padding data for encryption and un-padding data for decryption
+14.9k Golang : Get HTTP protocol version example
+5.1k Golang : How to deal with configuration data?
+29.5k Golang : How to get HTTP request header information?
+7.1k Golang : Not able to grep log.Println() output
+5.6k Golang : Find change in a combination of coins example