Re: [go-nuts] gofmt rewrite rules

2018-01-23 Thread Sebastien Binet
Wouldn't this be more a job for 'eg' instead? sent from my droid On Jan 23, 2018 2:03 PM, "Chris Hopkins" wrote: > Hi, > I'm tidying up some code and I think this would be a great use for gofmt's > rewrite capabilities, but I can't make it work. I have some code where > error checking is missin

Re: [go-nuts] gofmt rewrite rules

2018-01-23 Thread Jan Mercl
On Tue, Jan 23, 2018 at 2:03 PM Chris Hopkins wrote: > gofmt -w -r 'a.Set(b,c) -> err:=a.Set(b,c)\nif err != nil{log.Fatal("Set Error",err)}' I think the -r flag can handle only forms like 'expr1 -> expr2', but in this case expr2 is a statement. To my surprise I cannot find the flag documented a

[go-nuts] gofmt rewrite rules

2018-01-23 Thread Chris Hopkins
Hi, I'm tidying up some code and I think this would be a great use for gofmt's rewrite capabilities, but I can't make it work. I have some code where error checking is missing. In the code every instance of Set returns an error value that is not checked, so I assumed I could write: gofmt -w -r