Re: [go-nuts] Online service to run Go code with Go modules support

2020-11-20 Thread Aston Motes
Maybe confusingly, that's the expected output: https://github.com/rsc/quote/blob/master/quote_test.go :) On Fri, Nov 20, 2020 at 5:49 PM Alexey Melezhik wrote: > Thanks. I receive " Don't communicate by sharing memory, share memory by > communicating. " error (?) when run the example > >

Re: [go-nuts] keep just 2 decimal places in a float64

2020-01-25 Thread Aston Motes
Picking the first decimal library on pkg.go.dev, what about https://play.golang.org/p/Co96HKlvSMp ? On Sat, Jan 25, 2020 at 7:34 PM Kurtis Rader wrote: > You've fallen into a common trap. Base 2 floating point values cannot > represent most decimal values precisely. This is why you should

Re: [go-nuts] [64]byte()[:]

2019-11-15 Thread Aston Motes
https://play.golang.org/p/LNP6SK1J02V var b64 [64]byte // 64 zero bytes var x = make([]byte, 64) fmt.Println(bytes.Equal(b64[:], x)) On Fri, Nov 15, 2019 at 7:32 PM Gert wrote: > Is it possible to write this without creating a separate var b64 first? > Basically just write it in one line? > >

Re: [go-nuts] Re: `on err` alternative to `try()` has traction...?

2019-07-03 Thread Aston Motes
This proposal is not very much different from a one-liner if err != nil { } It's just 10 more characters. Granted, gofmt won't leave the one-liner formatted that way, but it's not much more typing and comes with the benefit of not needing a new keyword. One variation on this proposal that is a

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Aston Motes
Even though you can get at the values by iterating, I can't seem to do so with a direct reference to the NaN key: https://play.golang.org/p/69m-LK7obHA On Sun, Oct 21, 2018 at 4:18 PM Burak Serdar wrote: > On Sun, Oct 21, 2018 at 4:59 PM Dan Kortschak > wrote: > > > > They are not