Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Alberto Cortes
Thanks Ian and Jan, I see my error now. On Thursday, May 4, 2017 at 2:27:55 PM UTC+2, Ian Lance Taylor wrote: > > On Thu, May 4, 2017 at 5:22 AM, Alberto Cortes > wrote: > > I'm sorry Jan, I still don't understand why the type of `a` is > `main.go`. > > I don't see

Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Jan Mercl
On Thu, May 4, 2017 at 2:22 PM Alberto Cortes wrote: > Can you elaborate on your answer? %T produces packageName.typeName, where 'packageName' is the name of the package where 'typeName' is defined. But the universe scope is not a package, hence no 'packageName.'. --

Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Alberto Cortes
I'm sorry Jan, I still don't understand why the type of `a` is `main.go`. Can you elaborate on your answer? On Thursday, May 4, 2017 at 2:03:06 PM UTC+2, Jan Mercl wrote: > > On Thu, May 4, 2017 at 1:54 PM wrote: > > > Can you help me explain this behaviour? > > The

Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Jan Mercl
On Thu, May 4, 2017 at 1:54 PM wrote: > Can you help me explain this behaviour? The universe scope is not a package. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread alberto
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