Hello, I am a long time user of go, but I always had the impression that below code would not work as string and Status are different type. I thought I need to explicitly convert as ```exec(Status("abc"))``` it to work.
I think, this part of the spec may be the reason https://golang.org/ref/spec#Assignability - x is an untyped constant <https://golang.org/ref/spec#Constants> representable <https://golang.org/ref/spec#Representability> by a value of type T. Is there a way I can prevent this behavior. I am using Status like an enum, and only predefined status values should be allowed. https://play.golang.org/p/4zsb7KtPBC6 package main import ( "fmt" ) type Status string func main() { exec("abc") } func exec(s Status) { fmt.Printf("Hello, %s", s) } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a20a7034-19c3-410a-bc86-25deff38534f%40googlegroups.com.