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
+46.4k Golang : Read tab delimited file with encoding/csv package
+28.8k Get file path of temporary file in Go
+10.4k Golang : Convert file unix timestamp to UTC time example
+13k Golang : Convert IPv4 address to packed 32-bit binary format
+52k Golang : How to get time in milliseconds?
+9.3k Golang : Generate Codabar
+12.4k Golang : Get month name from date example
+7.9k Swift : Convert (cast) String to Double
+13.2k Golang : How to get a user home directory path?
+9.6k Golang : Apply Histogram Equalization to color images
+25.4k Golang : Convert uint value to string type
+10k Golang : Turn string or text file into slice example