Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net: Addr and Interface documentation is not clear #31276
What version of Go are you using (
Addr is more general than local network interfaces as indicated by the comment above it:
and net.Interface.Addrs() is more general than IP .
net.Interface.Addrs() does return Addr. In this case the type of Addr the system returns is IPNet. I would have also found this to be surprising (that I need to call ParseCIDR on addr.String() to get the IP portion); however, if a local interface has an IP address IPNet is more complete as the mask is important to making decisions about broadcasting and routing.