> Depends on your definition of “uses”, and I disagree with yours.
It really does not, unless you're also disagreeing with the definition of "is". Unpaired surrogates are not valid in a UTF-16 stream. If there are unpaired surrogates it's not UTF-16. If the system normally allows and generates unpaired surrogates, it's not dealing in UTF-16.
> It’s always technically possible to make invalid data. For example, you can write a web app that will send Content-type: application/json and invalid utf-8 in the response.
And that will blow up in the client, because your shit system has sent it garbage.
> Yes, technically these programming languages allow unpaired surrogates in strings.
Making them not-UTF-16.
> This is not necessarily a bad thing, there’re valid uses for such strings.
Like taking a pile of garbage and making it into a bigger pile of garbage.
Which is not relevant to to the issue at hand: such piles of crap are not UTF-16.
> For example, you can concatenate strings without decoding UTF16 into code points
That's not actually an example of your claims, you can concatenate valid UTF-16 without decoding it into codepoints as well.
> I hope you agree golang uses utf-8 strings.
I most certainly do not, why would you hope I agree with an obviously incorrect statement, what is wrong with you?
> Despite that, the unicode/utf8 standard package has ValidString function, which means you can still create invalid strings
Well you've got cause and effect reversed but yes you can create non-utf8 go strings, making Go's "strings" not utf8 at all.
> Does it mean golang uses wtf-8 instead of utf-8?
No, WTF-8 is something well-defined[0].
Golang's "strings" are just random bags of bytes, much like C's, and they're no more utf-8 than C's: you may assume they are of whatever encoding you're interested in but with no guarantee whatsoever that's actually the case and your assumptions may well blow up in your face.
[0] https://simonsapin.github.io/wtf-8/