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
+52k Golang : Convert HTTP Response body to string
+1.2k Golang : Launching your executable inside a console under Linux
+9.6k Golang : Gzip file example
+1k Golang & Javascript : How to save cropped image to file on server
+17.3k Golang : Call function from another package
+10.3k Golang : Create and resolve(read) symbolic links
+3.2k Fix fatal error: evacuation not done in time problem
+3.7k Golang : How to join strings?
+8.4k Golang : http.Get example
+4.2k Golang : Function wrapper that takes arguments and return result example
+20.4k Golang : Call a function after some delay(time.Sleep and Tick)
+2.2k CloudFlare : Another way to get visitor's real IP address