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
+9.2k Golang : Get all countries currencies code in JSON format
+18.2k Golang : Example for RSA package functions
+13.4k Golang : Convert spaces to tabs and back to spaces example
+10.4k Golang : Simple File Server
+5.1k Unix/Linux/MacOSx : How to remove an environment variable ?
+4.6k JQuery : Calling a function inside Jquery(document) block
+31.7k Golang : Validate email address with regular expression
+8.5k Golang : Random integer with rand.Seed() within a given range
+8.5k Golang : Heap sort example
+14.8k Golang : How do I get the local IP (non-loopback) address ?
+6.6k Nginx : Password protect a directory/folder
+13.9k Golang : How to pass map to html template and access the map's elements