Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-28 Thread Philip Boampong
Thanks for the reply. > Note that dup2() can only fail with EINTR if the new fd is currently open on > a "slow" device and the implicit close() fails due to being interrupted. I understand the condition may be rare, but I still want to know the correct way to handle it. > In my experience it

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-28 Thread Kurtis Rader
On Fri, Feb 28, 2020 at 12:41 PM wrote: > What to do on EINTR from syscall.Dup2 (Linux)? > > 1) It never happen. > 2) Retry. > 3) Take it as irrecoverable. > 4) Take it as success. > > I know this is more of an OS question, but it all started with the > asynchronous preemption announcement, and

[go-nuts] How to handle EINTR from syscall.Dup2

2020-02-28 Thread pboampong5
(I've asked the same question already, but probably in the wrong thread, sorry for the repost.) What to do on EINTR from syscall.Dup2 (Linux)? 1) It never happen. 2) Retry. 3) Take it as irrecoverable. 4) Take it as success. I know this is more of an OS question, but it all started with the

[go-nuts] Re: modules and my v2 package only partly appearing on go.dev

2020-02-28 Thread Paul Hankin
On Friday, 28 February 2020 21:04:04 UTC+1, Paul Hankin wrote: > > On Friday, 28 February 2020 20:43:16 UTC+1, Paul Hankin wrote: >> >> I am rather confused about modules, and have trouble making them work. >> >> I have a package: https://github.com/paulhankin/poker >> >> The go.mod looks like

[go-nuts] Re: modules and my v2 package only partly appearing on go.dev

2020-02-28 Thread Paul Hankin
On Friday, 28 February 2020 20:43:16 UTC+1, Paul Hankin wrote: > > I am rather confused about modules, and have trouble making them work. > > I have a package: https://github.com/paulhankin/poker > > The go.mod looks like this: ` > module github.com/paulhankin/poker/v2 > > go 1.13 > ` > > The

[go-nuts] modules and my v2 package only partly appearing on go.dev

2020-02-28 Thread Paul Hankin
I am rather confused about modules, and have trouble making them work. I have a package: https://github.com/paulhankin/poker The go.mod looks like this: ` module github.com/paulhankin/poker/v2 go 1.13 ` The package has a v1, and v2. At v2, I moved the main part of the package into a

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 9:39 AM Manlio Perillo wrote: > > On Friday, February 28, 2020 at 6:29:56 PM UTC+1, Ian Lance Taylor wrote: >> >> On Fri, Feb 28, 2020 at 9:14 AM Manlio Perillo wrote: >> > >> > On Friday, February 28, 2020 at 5:36:09 PM UTC+1, Ian Lance Taylor wrote: >> >> >> >> On Fri,

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Manlio Perillo
On Friday, February 28, 2020 at 6:29:56 PM UTC+1, Ian Lance Taylor wrote: > > On Fri, Feb 28, 2020 at 9:14 AM Manlio Perillo > wrote: > > > > On Friday, February 28, 2020 at 5:36:09 PM UTC+1, Ian Lance Taylor > wrote: > >> > >> On Fri, Feb 28, 2020 at 8:27 AM Manlio Perillo > wrote: > >>

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 9:14 AM Manlio Perillo wrote: > > On Friday, February 28, 2020 at 5:36:09 PM UTC+1, Ian Lance Taylor wrote: >> >> On Fri, Feb 28, 2020 at 8:27 AM Manlio Perillo wrote: >> > >> > On Friday, February 28, 2020 at 4:57:00 PM UTC+1, Ian Lance Taylor wrote: >> >> >> >> On Fri,

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Manlio Perillo
On Friday, February 28, 2020 at 5:36:09 PM UTC+1, Ian Lance Taylor wrote: > > On Fri, Feb 28, 2020 at 8:27 AM Manlio Perillo > wrote: > > > > On Friday, February 28, 2020 at 4:57:00 PM UTC+1, Ian Lance Taylor > wrote: > >> > >> On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg > wrote: > >> >

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 8:13 AM Peter Kleiweg wrote: > > Op vrijdag 28 februari 2020 16:57:00 UTC+1 schreef Ian Lance Taylor: >> >> On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg wrote: >> > >> > Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: >> >> >> >> >> >> Can you clarify

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 8:27 AM Manlio Perillo wrote: > > On Friday, February 28, 2020 at 4:57:00 PM UTC+1, Ian Lance Taylor wrote: >> >> On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg wrote: >> > >> > Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: >> >> >> >> >> >> Can you

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

2020-02-28 Thread Jake Montgomery
Contexts are great. And if your goal is to solve a specific problem, then sometimes they may be the best solution. But you implied in your OP that you were learning go. And in that case, I would still urge you to understand your original channel based code, and why it does not work, and how to

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Manlio Perillo
On Friday, February 28, 2020 at 4:57:00 PM UTC+1, Ian Lance Taylor wrote: > > On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg > wrote: > > > > Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: > >> > >> > >> Can you clarify that a bit? Did you change the code to look for EINTR

Re: [go-nuts] Can't pass -extldflags to golang

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 5:07 AM Olivia Nelson wrote: > > I'm trying to use extldflags with golang: > > -ldflags '-extld gcc -extldflags="-headerpad 0x500" -w -s' > > But go link does not recognize it, it prints the help dialog > > # command-line-arguments > usage: link [options] main.o > -B

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Peter Kleiweg
Op vrijdag 28 februari 2020 16:57:00 UTC+1 schreef Ian Lance Taylor: > > On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg > wrote: > > > > Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: > >> > >> > >> Can you clarify that a bit? Did you change the code to look for EINTR >

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Luke Mauldin
I agree that it is not a scalable architecture but unfortunately it is a large third party application the business depends on and it cannot be rewritten. Option 3 to use grpc is a good idea but unfortunately won’t work either because the Go shared library invokes C function calls back into the

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Amnon Baron Cohen
That does not sound like a scalable architecture! The number of simultaneous user connections the architecture can support is limited to the number of processes your server can run. The resources required by a process are orders of magnitude more than those required for a goroutine. And the Go

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Ian Lance Taylor
On Fri, Feb 28, 2020 at 7:18 AM Peter Kleiweg wrote: > > Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: >> >> >> Can you clarify that a bit? Did you change the code to look for EINTR errors >> and then retry the system call? > > > Yes, I did. But as an option that must be

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Luke Mauldin
The multiple instances are required to due to way the 3rd party application works. In brief, it creates a new process for each user connection and then each new process dynamically load the Go shared library to provide C extension points. -- You received this message because you are

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Peter Kleiweg
Op vrijdag 28 februari 2020 16:13:50 UTC+1 schreef Robert Engels: > > > Can you clarify that a bit? Did you change the code to look for EINTR > errors and then retry the system call? > Yes, I did. But as an option that must be enabled by the user. > -Original Message- > From: Peter

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Robert Engels
Can you clarify that a bit? Did you change the code to look for EINTR errors and then retry the system call?-Original Message- From: Peter Kleiweg Sent: Feb 28, 2020 9:04 AM To: golang-nuts Subject: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with

[go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-28 Thread Peter Kleiweg
Retry after EINTR solved the code lock-up too. Op woensdag 26 februari 2020 12:33:05 UTC+1 schreef Peter Kleiweg: > > With Go version 1.14 I get a lot of errors when I run: > > go test -v github.com/pebbe/zmq4 > > I didn't see this with Go 1.13.8 or any earlier version. > > Is this a problem

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Amnon Baron Cohen
> However, due to the nature of the application, there maybe 100 or 200 instances Interesting... Could you elaborate the nature of the application, and why a single instance is not enough... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Many instances question - shared library

2020-02-28 Thread Luke Mauldin
I have deployed a Go shared library on Linux that exposes C functions as extension points for a 3rd party application and is loaded dynamically at runtime. The 3rd party application then invokes "C" functions (which are backed by Go) and that is all working as expected. However, due to the

[go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
somebody beat us to it: https://github.com/torden/go-strutil#reversestr But for some strange reason, they seem to have made the this a method of a StringProc class. Perhaps they used to code in Java. On Friday, 28 February 2020 13:07:54 UTC, Himanshu Makkar wrote: > > Hi > > I think we can

[go-nuts] Go 1.14: how to -linkshared to a library produced by -buildmode=shared?

2020-02-28 Thread misha
Hello. I'm trying to build a shared library using `-buildmode=shared` and make a binary link to this shared library. The packages are: github.com/misha-ridge/splitlib/a (-> c) github.com/misha-ridge/splitlib/b (-> c) github.com/misha-ridge/splitlib/c github.com/misha-ridge/splitlib (-> a, b,

[go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Himanshu Makkar
Hi I think we can create a package to reverse a string and can use it whenever needed. reverse.go package strutil func Reverse(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return

[go-nuts] Can't pass -extldflags to golang

2020-02-28 Thread Olivia Nelson
I'm trying to use extldflags with golang: -ldflags '-extld gcc -extldflags="-headerpad 0x500" -w -s' But go link does not recognize it, it prints the help dialog # command-line-arguments usage: link [options] main.o -B note add an ELF NT_GNU_BUILD_ID note when using ELF ...

Re: [go-nuts] Significance of Mon Jan 2 15:04:05 -0700 MST 2006?

2020-02-28 Thread Dan Kortschak
Rob explained this in a thread a fair while back. > The choice was made by the output of the date command on my Unix > machine. I should have realized the format varies with locale. Mea > culpa. But I can still claim it's easy to remember and well > documented.

Re: [go-nuts] Significance of Mon Jan 2 15:04:05 -0700 MST 2006?

2020-02-28 Thread Jesper Louis Andersen
Each token is chosen such that it is unique in some way. So when the parser reaches a token, it can identify it and note the order in which they occur. This constructs the necessary knowledge we need to parse a real value. On Fri, Feb 28, 2020 at 10:53 AM Steve Mynott wrote: > I was just

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
That's cool! Of course we could reverse rune-slice in place, leaving a 7 liner... func Reverse(s string) string { r := []rune(s) for i, j := 0, len(r) - 1; i < j; i, j = i +1 , j-1 { r[i], r[j] = r[j], r[i] } return string(r) } On Friday, 28 February 2020 08:45:33 UTC, rog

[go-nuts] Significance of Mon Jan 2 15:04:05 -0700 MST 2006?

2020-02-28 Thread Steve Mynott
I was just wondering what was the significance, if any, of the magic time layout as used by time.Parse()? -- Steve Mynott cv25519/ECF8B611205B447E091246AF959E3D6197190DD5 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread roger peppe
On Fri, 28 Feb 2020 at 08:23, Amnon Baron Cohen wrote: > Here is a dumb version, that wastes loads of memory. > > func reverse(in string) string { >out := strings.Builder{} >out.Grow(len(in)) >runes:= make([]rune, 0, len(in)) > > >for _, r := range in { > runes =

[go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
Here is a dumb version, that wastes loads of memory. func reverse(in string) string { out := strings.Builder{} out.Grow(len(in)) runes:= make([]rune, 0, len(in)) for _, r := range in { runes = append(runes, r) } for i := len(runes) -1; i >= 0; i-- {