plgd-dev / go-coap

Implementation of CoAP Server & Client in Go
https://coap.technology
Apache License 2.0
447 stars 116 forks source link

netip in Go 1.18 #313

Open beriberikix opened 2 years ago

beriberikix commented 2 years ago

https://pkg.go.dev/net/netip

Go 1.18 introduces a new IP address format, that among other things, reduces memory usage (background.)

Are there plans to support 1.18 and adopt netip?

HRogge commented 2 years ago

The new netip package is definitely a HUGE step forward (we have been using it predecessor for quite a while)... unfortunately its slightly incompatible with its earlier revision (https://pkg.go.dev/inet.af/netaddr). So moving to netip would mean loosing compatibility with go 1.17 and earlier.

and some IDEs are still a bit shaky in terms of the new Go 1.18 features (generics!)

beriberikix commented 2 years ago

So moving to netip would mean loosing compatibility with go 1.17 and earlier.

Yup, that's what I figured would be the limiting factor. Is there a specific commitment to versions or backwards compat?

HRogge commented 1 year ago

Minimum Go version of Go-Coap has been changed to 1.18... maybe its time to reinvestigate?

There are not only net.IP, we might also look into replacing net.Addr in some functions (its a really horrible interface to work with).