Re: [go-nuts] How to do a cleanup of context cancelling?

2023-03-18 Thread Jeevesh Juneja
Proabably should change code to: func httpDo(ctx context.Context, req \*http.Request, f func(\*http.Response, error) error) error { // Run the HTTP request in a goroutine and pass the response to f. c := make(chan error, 1) req = req.WithContext(ctx) go func() { c <- http.DefaultClient.Do(req)

[go-nuts] Re: How to constraint type parameter not pointer

2023-03-18 Thread TheDiveO
How could I forget https://github.com/samber/mo...? On Saturday, March 18, 2023 at 7:00:03 PM UTC+1 TheDiveO wrote: > Maybe (no pun intended) implementations like > https://github.com/OlegStotsky/go-monads and > https://github.com/TeaEntityLab/fpGo can shed some more light on your > question a

[go-nuts] Re: How to constraint type parameter not pointer

2023-03-18 Thread TheDiveO
Maybe (no pun intended) implementations like https://github.com/OlegStotsky/go-monads and https://github.com/TeaEntityLab/fpGo can shed some more light on your question and implementation designs? On Saturday, March 18, 2023 at 11:37:59 AM UTC+1 李晓辉 wrote: > When I want to implement a Maybe[T

Re: [go-nuts] Help to choose the right type of the key for a map.

2023-03-18 Thread alex-coder
Ian and Andy, looks like the to string conversion works and even does not look ugly. :-) Thank you so much. пятница, 17 марта 2023 г. в 15:01:31 UTC+3, alex-coder: > Andy, thank you. > > In case there would be a choice between ugly and achievable, I must take > the last one:-) > > Another thin