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
+10.8k Golang : Create Temporary File
+11.2k Golang : How to use if, eq and print properly in html template
+15.6k Golang : Get digits from integer before and after given position example
+5.3k Golang *File points to a file or directory ?
+11.6k Golang : Secure file deletion with wipe example
+19.1k Golang : Execute shell command
+13.4k Golang : Get user input until a command or receive a word to stop
+11.2k Golang : Characters limiter example
+27.2k Golang : Convert CSV data to JSON format and save to file
+16.3k Golang : How to implement two-factor authentication?
+7k Golang : Squaring elements in array