You can use `ListenConfig.Listen` to do this: https://pkg.go.dev/net#ListenConfig.Listen I believe the reason to do it this way was the realization that there will probably be more ways to set up listening in the future and having lots of different ListenFoo functions in the package would overload the namespace too much.
On Tue, Dec 19, 2023 at 9:28 PM Michał Matczuk <mmatc...@gmail.com> wrote: > The context is passed downstream but cancelling it seems to have no effect. > I guess that the reason why it's not exported. > Can anyone shed more light on it? > > wtorek, 19 grudnia 2023 o 11:59:49 UTC+1 Michał Matczuk napisał(a): > >> If you take a look at net.Listen implementation >> >> func Listen(network, address string) (Listener, error) { >> var lc ListenConfig >> return lc.Listen(context.Background(), network, address) >> } >> >> you will notice the new listen API net.ListenConfig. >> >> This API is context aware, I think it would be handy if we had >> net.ListenContext the same way we have Dial and DialContext. >> >> Any thoughts on that? >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/8abe1abb-eb3b-4632-b3c0-e430f2f42270n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/8abe1abb-eb3b-4632-b3c0-e430f2f42270n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGavp70pXA%3DQWpa5NXroUWdCRhHUw%3D11JNssKDGvfgn3Q%40mail.gmail.com.