Re: [go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread Tyler Compton
As you are seeing, Go does not allow you to do a naked return when one of the named return values is being shadowed by another variable. If you take a look at the "Return statements" section in the Go Language Specification [1], it mentions this restriction: > Implementation restriction: A compile

Re: [go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread Burak Serdar
On Tue, Nov 27, 2018 at 8:03 PM hui zhang wrote: > happen in go 1.10.2 1.11.2 > Line 203 defines m3u8List, and uses the already defined err. Line 210 is in a nested scope, defines f and err, which shadows the err in the enclosing scope. Change it to: var f *os.File f, err= os.Open(...) an

[go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread hui zhang
happen in go 1.10.2 1.11.2 在 2018年11月28日星期三 UTC+8上午11:02:47,hui zhang写道: > > ./main.go:212:4: err is shadowed during return > > check code above only line 212 report err > however line 203 and 212 are almost the same case. but did not report err. > -- You received this message because you ar