Re: [go-nuts] fork/exec /bin/bash: operation not permitted

2019-08-07 Thread Kurtis Rader
You need to tell us the OS you are using as well as the Go version. Beyond that you should be able to provide a minimal reproduction program for an issue of this sort. Beyond the above, please note that in general you can't achieve what you're trying to do. The `setpgid()` syscall that the feature

[go-nuts] fork/exec /bin/bash: operation not permitted

2019-08-07 Thread Russtopia
Hi all, I'm trying to use the technique here https://medium.com/@felixge/killing-a-child-process-and-all-of-its-children-in-go-54079af94773 .. to ensure all children/grandchildren of my exec of /bin/bash die along with it, but I am getting the above 'operation not permitted' error when trying to

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread L Godioleskky
OK ...I now see the wisdom of why Go does not allow my simple example...Thanks ALL for you help on this On Wed, Aug 7, 2019 at 12:46 PM Adrian Ho wrote: > On 7/8/19 9:44 PM, lgod...@gmail.com wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > > requires, but if g(

Re: [go-nuts] Split a empty string will get a one element array?

2019-08-07 Thread Kurtis Rader
Please don't respond to threads that are seven years old. Having said that the behavior is reasonable and the behavior you and the O.P. expect is not reasonable. Consider the following examples: result := strings.Split("abc", "") result := strings.Split("ab", "b") result := strings.Split("", "")

Re: [go-nuts] Split a empty string will get a one element array?

2019-08-07 Thread Ian Lance Taylor
On Wed, Aug 7, 2019 at 3:14 PM wrote: > > Sorry, but why is that? Note that you are replying to a message that is more than seven years old. That said: why is what? What are you asking? Ian > On Tuesday, June 26, 2012 at 6:27:14 AM UTC-7, Peter S wrote: >> >> It follows this simple rule: the

Re: [go-nuts] Split a empty string will get a one element array?

2019-08-07 Thread jacohn1
Sorry, but why is that? On Tuesday, June 26, 2012 at 6:27:14 AM UTC-7, Peter S wrote: > > It follows this simple rule: the length of the result slice is the number > of occurrences of the separator plus one. It is the "right" (intended) > behavior, not a bug; in fact godoc has an equivalent exam

Re: [go-nuts] checksum mismatch inside docker and outside docker

2019-08-07 Thread Ian Lance Taylor
On Tue, Aug 6, 2019 at 11:51 PM Cholerae Hu wrote: > > I'm trying to build an private repo using go1.13beta1 in docker container. > But I got an checksum mismatch error. > Weirdly, I can successfully build it outside docker , with the same go.sum, > same version of go(go 1.13beta1). > I've alrea

[go-nuts] Go 1.13 will cause spurious deadline events in TCP servers

2019-08-07 Thread Liam
Go 1.13 enables TCP keepalive by default, and keepalive errors appear to be "deadline" events. This will impact working code that sets deadlines, perhaps breaking it in some cases. The fix is to disable TCP keepalives. This wasn't known when the listener keepalive-by-default change was accepted

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Adrian Ho
On 7/8/19 9:44 PM, lgod...@gmail.com wrote: > f( g() ) compiles  when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number  f (g(), g() ) wont > compile !! ...Is this not a Golang absurdity  ?? On the contrary, it's a good example of Go's pragmatism, al

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Robert Engels
I’m not sure that is the best argument. If it was a major change most likely the return types have changed as well, especially if new values are added, and thus it still would not compile. > On Aug 7, 2019, at 10:42 AM, Michel Levieux wrote: > > It avoids confusion AND silent errors. Imagine

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Michel Levieux
It avoids confusion AND silent errors. Imagine you have: func f() (int, int) func g() (int, int) func h(int, int, int, int) int And somewhere in your code this line appears: v = h(f(), g()) But for some reason, someday you need to change your code and now your function f and g have the followin

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread howardcshaw
On Wednesday, August 7, 2019 at 8:45:18 AM UTC-5, lgo...@gmail.com wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number f (g(), g() ) wont > compile !! ...Is this not a Golang absurdity ?? > >> >> Eh. Certainly abs

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread Ian Lance Taylor
On Wed, Aug 7, 2019 at 6:45 AM wrote: > > f( g() ) compiles when g returns exactly the number of args that f() > requires, but if g() returns only 1/2 that number f (g(), g() ) wont compile > !! ...Is this not a Golang absurdity ?? No. It avoids confusion. In case you missed Adrian's reply

Re: [go-nuts] Re: Question re fcns that return multiple values

2019-08-07 Thread lgodio2
f( g() ) compiles when g returns exactly the number of args that f() requires, but if g() returns only 1/2 that number f (g(), g() ) wont compile !! ...Is this not a Golang absurdity ?? On Tuesday, August 6, 2019 at 7:26:46 PM UTC-4, Ian Lance Taylor wrote: > > On Tue, Aug 6, 2019 at 4:14 PM

[go-nuts] Re: What did you see at GopherCon 2019 (San Diego)?

2019-08-07 Thread Akram Ahmad
- I checked (in the GopherCon Slack channel, the one we had going while I was attending the conference in San Diego recently, and which is still very active), and the latest is that, according to a GopherCon 2019 update (on July 25th), "*Videos should be online in a couple weeks

Re: [go-nuts] how to pass c array to golang efficiently

2019-08-07 Thread hui zhang
Got it, thanks! Jan Mercl <0xj...@gmail.com> 于2019年8月7日周三 下午4:20写道: > On Wed, Aug 7, 2019 at 3:17 AM hui zhang wrote: > > > //export Send > > func Send(confid string, len int, pcm *C.short) { > >//put c.short array to int16 slice/array efficiently , how ? > >// memcopy ? > > } > > s := (

Re: [go-nuts] how to pass c array to golang efficiently

2019-08-07 Thread Jan Mercl
On Wed, Aug 7, 2019 at 3:17 AM hui zhang wrote: > //export Send > func Send(confid string, len int, pcm *C.short) { >//put c.short array to int16 slice/array efficiently , how ? >// memcopy ? > } s := (*[^uint(0) >> 1]int16)(unsafe.Pointer(pcm))[:len] // s is []int16, len(s) = len -- Y