Println does not take format strings. You're thinking of Printf.
Yup, forgot to edit that :-/
Re:Learn X in Y minutes where X = Go
by cthackers on Wednesday September 04, 2013 @06:06AM
(#6326549)
That should be Printf. With Println you get "it's a %T 43". With Printf you get "it's a int"
Re:Learn X in Y minutes where X = Go
by JulianMorrison on Wednesday September 04, 2013 @05:07AM
(#6326417)
Are you mixing up Println and Printf?
Re:Learn X in Y minutes where X = Go
by mseepgood on Wednesday September 04, 2013 @05:13AM
(#6326430)
No, it's correct. It's meant to print "it's a 84".
Would't you expect either "it's 84" or "it's a(n) int|decimal|other_type"?
I figured they ment to do the latter, since the next print function outputs: "it's a string".
Re:Learn X in Y minutes where X = Go
by mseepgood on Wednesday September 04, 2013 @06:45AM
(#6326649)
Since c is a chan int it can only be an int, no other type. You could directly write fmt.Println("it's an int").
Re:Learn X in Y minutes where X = Go
by ivanvanderbyl on Wednesday September 04, 2013 @04:11AM
(#6326235)
I just tried it, both seem correct as fmt.PrintLn takes multiple inputs
fmt.Println("it's a", i)
Should be something like:
fmt.Println("it's a %T", i)
See http://golang.org/pkg/fmt/ for more options.
[update]
Forgot they allowed to send pull requests; done :)