Re: [go-nuts] What's the difference between local variables and fields when it comes to ignoring errors?

2018-10-02 Thread Michael Jones
I’m so glad to read this! I’m away from my computer but feeling like I’d failed a Go skill test...I could not imagine a problem either. On Tue, Oct 2, 2018 at 6:38 AM Ian Lance Taylor wrote: > On Tue, Oct 2, 2018 at 6:21 AM, wrote: > > > > I'd like to understand the reasoning in Go better. > >

Re: [go-nuts] What's the difference between local variables and fields when it comes to ignoring errors?

2018-10-02 Thread Ian Lance Taylor
On Tue, Oct 2, 2018 at 6:21 AM, wrote: > > I'd like to understand the reasoning in Go better. > > This code is allowed: > newlocalvar, _ := strconv.Atoi(somestring) > > And this code is forbidden: > somestruct.field, _ = strconv.Atoi(somestring) Please show us a complete example, perhaps in the

Re: [go-nuts] What's the difference between local variables and fields when it comes to ignoring errors?

2018-10-02 Thread Jan Mercl
On Tue, Oct 2, 2018 at 3:29 PM wrote: > This code is allowed: > newlocalvar, _ := strconv.Atoi(somestring) > > And this code is forbidden: > somestruct.field, _ = strconv.Atoi(somestring) It is not forbidden: https://play.golang.org/p/YYUWhcNtPQB -- -j -- You received this message because y

[go-nuts] What's the difference between local variables and fields when it comes to ignoring errors?

2018-10-02 Thread flockemark44
Hi! :-) I'd like to understand the reasoning in Go better. This code is allowed: newlocalvar, _ := strconv.Atoi(somestring) And this code is forbidden: somestruct.field, _ = strconv.Atoi(somestring) At least it does not compile, and so far I have learned that the reason is you should not ignor