Re: [go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-11 Thread sbkim via golang-nuts
On Friday, October 7, 2016 at 4:57:29 PM UTC-7, Ian Lance Taylor wrote: > > On Fri, Oct 7, 2016 at 4:18 PM, sbkim via golang-nuts > > wrote: > > > > If an operand of fmt.Printf implements method String() string, > fmt.Printf > > respects it and uses it. >

[go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-07 Thread sbkim via golang-nuts
Hello group, If an operand of fmt.Printf implements method String() string, fmt.Printf respects it and uses it. But it doesn't if an operand is a a struct that has such an element. For example, https://play.golang.org/p/QJC7Q9Kpch: package main import "fmt" type Int int func (i Int) String()

[go-nuts] Naming initialisms or acronyms containing lowercase letters

2016-09-26 Thread sbkim via golang-nuts
go/gocomments#TOC-Initialisms says initialisms or acronyms (e.g. "URL" or "NATO") have a consistent case: URL or url. But sometimes we have ToR (top-of-rack switch), QoS (quality of service), or DoS (denial of service) that are commonly written with a combination of upper- and lower-case letter

Re: [go-nuts] Syntax errors involving compound literals

2016-08-25 Thread sbkim via golang-nuts
On Wednesday, August 24, 2016 at 10:22:22 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Aug 24, 2016 at 9:21 PM, sbkim via golang-nuts > > wrote: > > Hello group, > > > > Why are the following snippets errors? > > > > https://play.golang.org/p/m

[go-nuts] Syntax errors involving compound literals

2016-08-24 Thread sbkim via golang-nuts
Hello group, Why are the following snippets errors? https://play.golang.org/p/mgEYMNNw9h type S struct { i int } if S{i: 0} == S{} { } syntax error: unexpected == at end of statement switch S{i: 0} == S{} { } syntax error: unexpected i, expecting case or default or } It works without erro