Re: [go-nuts] Re: Protective buffered channel that never triggers deadlock

2022-04-13 Thread Zhaoxun Yan
You are right, Brian. The difference is not whether the channel is buffered or unbuffered - while the receiver is present, none will encounter the deadlock. package main import ( "fmt" "time" ) //var c = make(chan int) var c = make(chan int, 2) func report(){ for{ select

Re: [go-nuts] errors (langChange)

2022-04-13 Thread Ian Lance Taylor
On Wed, Apr 13, 2022 at 2:44 PM Matthias Mädel wrote: > > Please some advice if something like the following could be helpful and if it > is possible to implement with the compiler. > > Thank You > > func Experimental(src, dst string) error { > > //goto is blocked with err == nil > goto r

[go-nuts] errors (langChange)

2022-04-13 Thread Matthias Mädel
Hello Please some advice if something like the following could be helpful and if it is possible to implement with the compiler. Thank You func Experimental(src, dst string) error { //goto is blocked with err == nil goto r, err := os.Open(src) defer r.Close() goto w, err := os.

[go-nuts] Timeout on Goroutines

2022-04-13 Thread Suresh Tupakula
It is always safer to have the time out on goroutines. The timeout can happen because of the goroutine would have called the RESTEND point which is not responding (even though it is alive) or network latency or the other process have locked up resources for longer period. In these cases I can

[go-nuts] Re: No downloadable go1.18.1 version for darwin

2022-04-13 Thread Brian Candler
It's mentioned in the original announcement : "macOS binary artifacts for Go 1.18.1 are not available at this time due to an issue . We are working on providing them as soon as possible. Sorry for t

[go-nuts] Re: No downloadable go1.18.1 version for darwin

2022-04-13 Thread Yulrizka
Appologize, should've read the release thread, it's a known issue https://github.com/golang/go/issues/52317 On Wednesday, April 13, 2022 at 4:33:44 PM UTC+2 Yulrizka wrote: > I see from release history that go.1.18.1 was released yesterday. > > But it seems that the download page does not contai

[go-nuts] No downloadable go1.18.1 version for darwin

2022-04-13 Thread Yulrizka
I see from release history that go.1.18.1 was released yesterday. But it seems that the download page does not contain package for darwin like previous version This command also failed go1.18.1 download go1.18.1: download failed: no binary release of go1.18.1 for darwin/amd64 at https://dl.goo

[go-nuts] Re: Ignore data race

2022-04-13 Thread Brian Candler
"There is no such thing as a benign data race" https://docs.google.com/document/d/1WAT22FtFdMt43i3O8YrnlQTNTzZ3IoJBtu3P2DNRytg/ # was originally: https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong On Wednesday, 13 April 2022 at 14:46:34 UTC+1 Miraddo

[go-nuts] Ignore data race

2022-04-13 Thread Miraddo
Sometimes in some scenarios, we might find that having the data race might be not so bad, my question is how many ways we have to ignore data race in the Golang. I found out with build tags, we could ignore the data race => // +build !race do we have some other ways without building tags? -- Yo

Re: [go-nuts] [gollvm] Test for GoLLVM?

2022-04-13 Thread 'Than McIntosh' via golang-nuts
>Any ideas about running the tests under go/test directory Yes, as you surmise it would be mainly about developing the appropriate test harness. We haven't done anything in that direction for gollvm, but it seems doable overall. Than On Tue, Apr 12, 2022 at 3:20 AM Lanzhiguan Huang wrote: > H

Re: [go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Robert Engels
That is not a general idiom. That is a specialized case that maps the buffer size on a channel to the size of an ancillary structure. In general if you are spinning waiting for channels you’ve done something wrong. Go has no concept of cpu affinity so the practice has little value. (Note that

[go-nuts] Re: Protective buffered channel that never triggers deadlock

2022-04-13 Thread Brian Candler
> I made up a work around that just dumps the new message if the buffer is full: You don't need to do that: use select { ... } to check if the channel is ready to receive or not. https://go.dev/play/p/Mb7VVCTvnfk But in practice, this is almost never needed, because one goroutine is doing the

Re: [go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Robert Engels
Adding to a full buffered channel will not cause a crash. It can deadlock just as the unbuffered can - but the deadlocks can be harder to diagnose. > On Apr 13, 2022, at 3:40 AM, Zhaoxun Yan wrote: > >  > Since I found if inserting into a buffered channel could cause a crash if it > is full

Re: [go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Shulhan
On Wed, 13 Apr 2022 01:40:22 -0700 (PDT) Zhaoxun Yan wrote: > Since I found if inserting into a buffered channel could cause a > crash if it is full already > ( now I only use unbuffered channels in work) > https://groups.google.com/g/golang-nuts/c/U8lz6noKkuA > > package main > > var c = make(

[go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Zhaoxun Yan
Since I found if inserting into a buffered channel could cause a crash if it is full already ( now I only use unbuffered channels in work) https://groups.google.com/g/golang-nuts/c/U8lz6noKkuA package main var c = make(chan int, 1) func main() { c <- 1 c <- 2 //fatal error: all goro

[go-nuts] Re: Why Go has only slice and map

2022-04-13 Thread Zhaoxun Yan
https://github.com/Workiva/go-datastructures Are they available in the current version of go? 在2022年4月12日星期二 UTC+8 23:21:20 写道: > I'm certainly not privy to the nitty-gritty, but I'd encourage you to skim > over the Go Dev team meeting notes. It's really cool to see what people > have propose

Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-13 Thread Brian Candler
> I am a little bewildered by the new mod configuration. It's as simple as this: go mod init blah go mod tidy You can put anything(*) for "blah". Literally "blah" will work. It's just whatever name you want to give your module. However if you plan to publish your module on github then using "