News Score: Score the News, Sort the News, Rewrite the Headlines

Go Enums Suck

Go Enums Suck Go doesn’t technially have Enums and it is a missing feature in my book but there is a Go idiomatic way to achieve roughly the same thing. Go does have however the iota keyword. This is basically a self incrementing integer - so you end up writing Enums something like this: type Operation int const ( Escalated Operation = iota Archived Deleted Completed ) This is fine however it is nothing but an integer under the covers this means what we actually have is: const ( Escalated Opera...

Read more at zarl.dev

© News Score  score the news, sort the news, rewrite the headlines