Comment by ngrilly
I must say that I really appreciate your patience in addressing these comments. If the possibility of race conditions leading to UB and the lack of sum types in Go are so bad for security, then it shouldn't be difficult to observe exploitable vulnerabilities in real-world Go code bases.
In a specific scenario, I have made use of interface values, and type switches as a form of "tagged union" / "sum type".
All it requires is that the module defining the interface, and structs implementing it, are in the same package, and the interface requires a private method.
I used that to have a message type, passing instances of it over a channel of that interface, and demuxing based on a type switch of the message.
One could use a similar scheme for return values from functions, just that for the simple error / no-error case it would not be idiomatic, however that should not prevent one from doing so if desired.