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
+14.3k Golang : syscall.Socket example
+26.7k Golang : Convert(cast) string to uint8 type and back to string
+19.2k Golang : Clearing slice
+17.8k Golang : Parse date string and convert to dd-mm-yyyy format
+40.9k Golang : Convert to io.ReadSeeker type
+8.5k Golang : Implementing class(object-oriented programming style)
+13.3k Golang : How to get a user home directory path?
+18.1k Golang : Simple client server example
+19k Golang : Implement getters and setters
+20.7k Swift : Convert (cast) Int to int32 or Uint32
+22k SSL : How to check if current certificate is sha1 or sha2