Yes, that's true. I try to stay away from string enums for this very reason. According to the assignability spec here: go.dev/ref/spec#Assignability. I think Go could do a lot better with their enums. They feel like an after thought. For example, this code is valid even though `yell` is not a defined color. package main import "fmt" type color string const ( Yellow color = "yellow" Red color = "red" Blue color = "blue" ) func main() { fmt.Println("hello") printColor(Blue) printColor("yell") } func printColor(c color) { fmt.Println(c) }
@@CoderNick True. I am coming from php/csharp, trying to explore other languages. Go seems great because of the performance and simple mulitthreading system.
I highly recommend it. I came from c++ and Python background and switched to Go about 10 years ago. It’s much easier than c++ especially for big sw teams and much faster than python. No language is perfect and that goes for Go as well. Little quirks like this and generics are really confusing right now. Lots of jobs are out there in Go.