I would expect the following code to print `int`, but it prints `main.go`, 
which was quite a surprise for me:

```
package main

import (
"fmt"
)

type foo int

const (
_ foo = iota
a
)

func main() {
fmt.Printf("%T\n", a)
}
```

playground link: https://play.golang.org/p/8f8sUATRwm

On the other hand, if I change the first constant to an untyped constant, 
the program prints what you would expect, this is `int`:

```
package main

import (
"fmt"
)

type foo int

const (
_ = iota
a
)

func main() {
fmt.Printf("%T\n", a)
}
```

playground link: https://play.golang.org/p/MtKkixq7aq

Can you help me explain this behaviour?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to