Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 6:17 PM Robert Engels wrote: > > The could be calling fork() as in the system call - which copies all file > descriptors but I didn’t think Go processes could fork. > > Seems you would need to remap stdin and stdout in the fork to do anything > useful. > > This sounds very

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Robert Engels
The could be calling fork() as in the system call - which copies all file descriptors but I didn’t think Go processes could fork. Seems you would need to remap stdin and stdout in the fork to do anything useful. This sounds very PHP - what goes around comes around. > On Mar 1, 2024, at 8:01 

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 5:57 PM Jeff Stein wrote: > > I'm struggling to understand if I'm able to do something. > > > In my very odd use case we are writing a websever that handles connections > via a forked process. > > I have a listener process that listens for TCP connections. > > So each net.C

[go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Jeff Stein
I'm struggling to understand if I'm able to do something. In my very odd use case we are writing a websever that handles connections via a forked process. I have a listener process that listens for TCP connections. So each net.Conn that comes in we pull off its file descriptor: *fd, err := co

Re: [go-nuts] Adding context.Context as first parameter in every function

2024-03-01 Thread Sam Vilain
Hi Yash, unfortunately that's the only approach at the moment. Your request is very apropos of my thread, "Could we trade all the `ctx context.Context` arguments for one pointer in `g`?". This is the exact use case I have in mind.  I believe it should be possible, and even a fairly naïve imple

Re: [go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread 'BENTLEY Thom' via golang-nuts
I just discovered that the executable is created using -ldflags -H=windowsgui. Because of that, I need to pipe to out-text in a PowerShell to see Println output but that doesn’t show the panics. If I remove the flags, then I can see all the output. I don’t know if they are absolutely needed so I

Re: [go-nuts] Do we need to drain a closed channel ?

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 6:26 AM Shubha Acharya wrote: > > I have been working with buffered channels. I have stumbled upon a scenario > where buffered channel will be closed and the receivers of the channel > terminates before consuming all the elements in the buffer. So my question is > will th

Re: [go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 5:09 AM jake...@gmail.com wrote: > > FWIW, in a very simple test on Windows 10 in a powershell console, running a > go executable built with go1.19 prints the panic just like in a regular cmd > console. There have been a lot of changes related to Windows consoles since t

[go-nuts] Do we need to drain a closed channel ?

2024-03-01 Thread Shubha Acharya
Hey, I have been working with buffered channels. I have stumbled upon a scenario where buffered channel will be closed and the receivers of the channel terminates before consuming all the elements in the buffer. So my question is will there be any issue regarding Garbage Collection of channel w

Re: [go-nuts] I am having trouble getting go.crypto ssh client to connect

2024-03-01 Thread My Xaomix
The error message "ssh: unable to authenticate, no supported methods remain" typically indicates that the SSH client and server were unable to negotiate a mutually supported authentication method. In your code, you're using password authentication (ssh.ClientAuthPassword), but it seems like

Re: [go-nuts] adding context.Context to new code

2024-03-01 Thread 'Yash Bansal' via golang-nuts
@nazri Were you able to achieve this? Adding context to every function. Is there any repository/library available for the same. I have been one of the unaware ones who started writing a new service without adding context explicitly. On Friday, May 19, 2017 at 9:34:22 AM UTC+5:30 Nazri Ramliy

[go-nuts] Adding context.Context as first parameter in every function

2024-03-01 Thread 'Yash Bansal' via golang-nuts
Hello, I recently started writing code in Golang and wasn't aware that unlike Java, we can't use ThreadLocals to propagate a context across the code. It's mandatory to explicitly pass a context. I have already written a service which is live in production now, however for monitoring and other

[go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread jake...@gmail.com
FWIW, in a very simple test on Windows 10 in a powershell console, running a go executable built with go1.19 prints the panic just like in a regular cmd console. On Wednesday, February 28, 2024 at 3:20:55 PM UTC-5 Thom BENTLEY wrote: > Hi All, > > OS: Windows 10 > GoLang: go1.6.3 windows/386