Re: [go-nuts] Re: signal.NotifyContext - Does it expose the signal handled?

2021-05-21 Thread Amit Saha
Thanks. On Sat, 15 May 2021, 12:48 am Vladimir Varankin, wrote: > I don't think the current API provides that functionality. > > In the original proposal for signal.NotifyContext, there were several > discussions, including related to what features the new API should provide. > The consensus

Re: [go-nuts] Assign to struct field dynamically (type t does not support indexing)

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 2:38 PM Jay Adams wrote: > > Is it possible to assign to struct fields where the field name is in a > variable? Any suggestions on how I get that to work? Thank you. In Go this is done using type reflection. https://play.golang.org/p/7Wt8eczIeXO Ian -- You received

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 1:47 PM Brian Candler wrote: > > If I understand rightly, it boils down to this: > https://play.golang.org/p/vYlTzluIuBL Thanks. That's clearly a bug. The sig.ignored mask is not being updated when it should be. > The documentation does say "Reset undoes the effect of

[go-nuts] Assign to struct field dynamically (type t does not support indexing)

2021-05-21 Thread Jay Adams
Greetings, I need to be able to assign a value to a struct field where I specify the field name in a variable. After searching around I thought the following approach would work but I still get the "type does not support indexing" error. This example is simplified: type item struct { red

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Brian Candler
If I understand rightly, it boils down to this: https://play.golang.org/p/vYlTzluIuBL The documentation does say "Reset undoes the effect of any prior calls to Notify for the provided signals", without mentioning any effect on Ignore'd signals. On

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 1:37 PM Manlio Perillo wrote: > > On Friday, May 21, 2021 at 10:22:08 PM UTC+2 Ian Lance Taylor wrote: >> >> On Fri, May 21, 2021 at 7:49 AM Manlio Perillo wrote: >> > >> > In a program I want to read a password from the terminal, using >> > golang.org/x/term. >> > The

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Manlio Perillo
On Friday, May 21, 2021 at 10:22:08 PM UTC+2 Ian Lance Taylor wrote: > On Fri, May 21, 2021 at 7:49 AM Manlio Perillo > wrote: > > > > In a program I want to read a password from the terminal, using > golang.org/x/term. > > The problem is that there is a possibility that a signal is sent to

Re: [go-nuts] How to restore ignored signals

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 7:49 AM Manlio Perillo wrote: > > In a program I want to read a password from the terminal, using > golang.org/x/term. > The problem is that there is a possibility that a signal is sent to the > program, resulting in the terminal state not being restored: >

Re: [go-nuts] When will the stack of a goroutine shrink?

2021-05-21 Thread Ian Lance Taylor
On Fri, May 21, 2021 at 7:46 AM tapi...@gmail.com wrote: > > From the outputs of the following program, > it looks the stack of a goroutine doesn't shrink immediately. > Will it shrink at some point eventually? > > > package main > > func f(i int) byte { > type T int // avoid f being inline >

[go-nuts] How to restore ignored signals

2021-05-21 Thread Manlio Perillo
In a program I want to read a password from the terminal, using golang.org/x/term. The problem is that there is a possibility that a signal is sent to the program, resulting in the terminal state not being restored: https://play.golang.org/p/4IjLve9gDx0 In case of term.ReadPassword, on Linux I

[go-nuts] When will the stack of a goroutine shrink?

2021-05-21 Thread tapi...@gmail.com
>From the outputs of the following program, it looks the stack of a goroutine doesn't shrink immediately. Will it shrink at some point eventually? package main func f(i int) byte { type T int // avoid f being inline var a [1<<20]byte // make stack grow return a[i] } func main(){