[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-29 Thread T L
you can use go vet -shadow to try to find the potential bugs related to shadowing. Personally, I feel the proposal in https://github.com/golang/go/issues/377 :n, err =

[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-29 Thread Drew Derbyshire
Given all Go's narrow minded ideas for the sake of purity, := should be considered a vicious hack and removed from the language. Adding a simple var err At the top of a routine won't kill people. In my own experience, that construct is the single largest cause of trivial errors in Go

[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-29 Thread Damian Gryski
On Monday, October 29, 2018 at 5:05:40 AM UTC-7, Sokolov Yura wrote: > > Yes, err handling is a part of variable shadowing mistakes. But it is not > all such mistakes. > I shadowed other variables at least as often as errors. > While shadowing is sometimes an issue, warning every times it

[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-29 Thread Sokolov Yura
Yes, err handling is a part of variable shadowing mistakes. But it is not all such mistakes. I shadowed other variables at least as often as errors. воскресенье, 28 октября 2018 г., 21:42:54 UTC+3 пользователь Liam написал: > > Since most variable re-declaration is to support error variables,

[go-nuts] Re: Go2 proposal: remove := operator (or remove variable shadowing)

2018-10-28 Thread Liam
Since most variable re-declaration is to support error variables, one likely outcome of the new error handling scheme is to end the need for it. v1, err := f1() // this v2, err := f2() v1 := check f1() // becomes this (proposed by Go team) v2 := check f2() v1, ?err := f1() // or this (invokes