Re: [go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread 'Axel Wagner' via golang-nuts
(then again, the fact that this works seems slightly concerning to me: https://play.golang.org/p/phWQ83wPQtx) On Sun, Feb 9, 2020 at 1:12 AM Axel Wagner wrote: > No need for unsafe: > https://play.golang.org/p/7cTejtO-I1z > You can't *modify* the field, but you can read it just fine. In fact, >

Re: [go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread 'Axel Wagner' via golang-nuts
No need for unsafe: https://play.golang.org/p/7cTejtO-I1z You can't *modify* the field, but you can read it just fine. In fact, that's how fmt does it as well: https://play.golang.org/p/cuFQMsvLmaZ I suspect you are seeing the error you are seeing because you are either trying to modify it

[go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread Tamás Gulácsi
2020. február 8., szombat 20:42:32 UTC+1 időpontban Alexander Mills a következőt írta: > > it looks like this way works: > > https://stackoverflow.com/a/43918797/12211419 > > know of any others? > Yup, that's one - get the address of the field and get that. Another is to declare a similar

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 18:38:19 UTC, addi t0t08 wrote: > > > Also, without any additional changes to the language. Go already allows > separating statements with semicolons, so it would be even possible to do > the following. > > > > f, err := os.Open(file1) ; pass err > defer f.Close() >

[go-nuts] re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread Alexander Mills
it looks like this way works: https://stackoverflow.com/a/43918797/12211419 know of any others? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread addi t0t08
On Saturday, February 8, 2020 at 10:55:10 AM UTC-7, Brian Candler wrote: > > On Saturday, 8 February 2020 10:33:03 UTC, addi t0t08 wrote: >> >> No, 'pass' accepts an error type. in this case Foo function must return >> an error type otherwise that would be a compile error. >> >> > Ah I see: you

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 10:33:03 UTC, addi t0t08 wrote: > > No, 'pass' accepts an error type. in this case Foo function must return an > error type otherwise that would be a compile error. > > Ah I see: you are relying on the behaviour of errors.Wrap(nil, "dontcare"), which is valid and

[go-nuts] re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread Tamás Gulácsi
Yes, I know several ways. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-08 Thread stephen . illingworth
On Saturday, 8 February 2020 08:38:40 UTC, Eric S. Raymond wrote: > Go, on the other hand...I'm an old > hand from the same culture the Go devs exemplify. > I'm glad somebody else has said that. For me, Kernighan and Pike's involvement was the clinching argument in favour of Go. Coding

[go-nuts] re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-08 Thread Alexander Mills
I am trying to get an answer to my github gist Q: https://gist.github.com/ORESoftware/9253433dc0f5af52df8eff7c26e689a0 if anyone knows if this is possible in Golang v1.13+ please lmk -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Kevin Chadwick
Your arguments against the current system seem very weak to me. An editor can if you really care; fold on if err like it can on functions. I would be strongly against hiding critical code in my company though. For if err == nil or not return at all but log and try again etc. We now have

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread addi t0t08
On Saturday, February 8, 2020 at 2:14:31 AM UTC-7, Brian Candler wrote: > On Saturday, 8 February 2020 07:02:34 UTC, addi t0t08 wrote: >> >> I think the keyword we are looking for is `pass`. Similarly, `pass` only >> needs to return if err != nil. >> >> func writeSomething() error { >>f, err

[go-nuts] Re: [golang-dev] Go 1.14 Release Candidate 1 is released

2020-02-08 Thread Jan Mercl
On Wed, Feb 5, 2020 at 8:43 PM Carlos Amedee wrote: > We have just released go1.14rc1, a release candidate version of Go 1.14. I am glad to report substantial improvements for a set of benchmarks of the gocc compiler[0], which is an experimental/WIP C compiler implemented in Go that can also

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 07:02:34 UTC, addi t0t08 wrote: > > I think the keyword we are looking for is `pass`. Similarly, `pass` only > needs to return if err != nil. > > func writeSomething() error { >f, err := os.Open("file.dat") >pass err >defer f.Close() > >

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-08 Thread Eric S. Raymond
Bakul Shah : > Did you consider using nim? It is much closer to python. You could've even > selectively replaced python bits with nim bits based on profiling. I did, very briefly. At the time I had to make the decision - a little over a year ago now - Nim did not seem quite well-established