In util.go, the function charAt is never used and can be removed completely. However, if you intend to use it, you may want to change it.
Currently, if the provided index is out of bounds, the function returns 0. However Go, unlike C, allows null characters (\u0000) in strings. It's therefore impossible to distinguish between an out-of-bound index and a null character.
You could fix this by returning -1 instead, since the rune type is just an alias for int32.
In
util.go
, the functioncharAt
is never used and can be removed completely. However, if you intend to use it, you may want to change it.Currently, if the provided index is out of bounds, the function returns 0. However Go, unlike C, allows null characters (
\u0000
) in strings. It's therefore impossible to distinguish between an out-of-bound index and a null character.You could fix this by returning -1 instead, since the
rune
type is just an alias forint32
.