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 

I think, this part of the spec may be the reason 

   - 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 


package main

import (

type Status string

func main() {

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 

Reply via email to