Re:Golang's network stack attempts to parse HTTP headers as ...
by papaf on Thursday January 21, 2021 @08:52AM
(#25858741)
Its a common mistake to assume strings are UTF-8 but it is a mistake.
This is not a defence of Go but more of a warning to Go programmers.
> In a go a string is an immutable byte slice assumed to be valid utf8, with associated methods and users which all assume that slice of memory is valid utf8.
Which is in my opinion the worst choice you could make when designing a type. If I'm working in a typed language because of so-called "type safety", if I can't trust my types to actually enforce their guarantees, what can I trust ?