onelang / OneLang

MIT License
1.12k stars 84 forks source link

Go: bitwise complement operator is ^, not ~ #23

Open dolmen opened 6 years ago

dolmen commented 6 years ago

The following code:

var x = 3;
x = ~x;

must be translated to Go as:

x := 3;
x = ^x;  // Not ~x

See https://play.golang.org/p/CbJQ-gPguyG