Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
Sorry again. Well, I followed your advice. Here is the link https://play.golang.org/p/7DigEVsKbdx How can I cancel goToSleep() when timeout is reached? El lunes, 24 de febrero de 2020, 14:16:32 (UTC-3), Jake Montgomery escribió: > > Your code will still not compile. In this group, it is often

[go-nuts] Re: odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Jake Montgomery
FWIW, I also don't see any appreciable difference: goos: windows goarch: amd64 BenchmarkStateSet1-4 1368303 872 ns/op BenchmarkStateSet2-4 1379320 887 ns/op BenchmarkStateSet3-4 1343781 865 ns/op PASS ok command-line-arguments 7.446s On

[go-nuts] Re: odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Jim Robinson
That's interesting! My numbers earlier were from an AMD chip (2990WX) on Linux 5.3.11. On an older Intel chip (i7-4960HQ) on macOS 10.15.3 I still see small a difference but it's much smaller. $ go test -bench . goos: darwin goarch: amd64 BenchmarkStateSet1-82737468 441 ns/op

[go-nuts] Re: odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Sean Liao
maybe it's just your system? master » gotip test -bench . goos: linux goarch: amd64 pkg: testrepo-75 BenchmarkStateSet1-44173546 273 ns/op BenchmarkStateSet2-44547119 261 ns/op BenchmarkStateSet3-44556757 263 ns/op PASS ok testrepo-75 4.899s On Monday, February

Re: [go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-24 Thread 'Eric Johnson' via golang-nuts
Thanks for the pointers. I was hoping for an easier answer. Maybe will look into patching stdlib. Eric. On Sat, Feb 22, 2020 at 1:15 AM Brian Candler wrote: > Looks like your thoughts are the right ones: > >

[go-nuts] odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Jim Robinson
Hi folks, I was testing some code and I noticed something that struck me as little odd. In the following code: https://play.golang.org/p/z8OOCrnZ85s we have routines Set1, Set2, and Set3. They do the same thing, but change where time.Now().Unix() is called. Set1 calls for the time before it

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Jake Montgomery
Your code will still not compile. In this group, it is often helpful to include a link to your code in the playground (https://play.golang.org/) using the "Share" button. That is in addition to, or instead of, posting your code in the message. This will allow others to easily run your code,

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
Sorry}, here is the right code: ( just was the effect to b working til At 5:20am sleepy and lost) Expected behaviour is to end anonyimous func when 3s timeout is reached. // package main import( //"fmt" "time" "math/rand" "log" ) func

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Lutz Horn
> I've tried to adapt from from "Concurrency in Go by Katherine Cox-Buday" to > understand how to apply timeout. But I don't get it. What are you trying to do? What is the expected behaviour, what happens instead? BTW, this code does not compile, there are same unbalanced curly brackets. Lutz

[go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
Hi everybody, I've tried to adapt from from "Concurrency in Go by Katherine Cox-Buday" to understand how to apply timeout. But I don't get it. What I'm doing wrong? Here the code: package main import( //"fmt" "time" "math/rand" "log" )

[go-nuts] Re: [ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

2020-02-24 Thread Elias Naur
On Saturday, February 22, 2020 at 5:00:33 AM UTC+1, howar...@gmail.com wrote: > > > I have updated it to support go modules, and added support for the > recently appearing Gio and Fyne GUI toolkits. They are both operational, if > a bit oddly. I tested Gio on Windows yesterday when I had a