Standard library / net
net.IPNet.String()
Return the network in CIDR form for a contiguous mask. Expected stdout: '192.0.2.0/24\n'.
Formal Syntax & Structure
go syntaxgo
func (n *IPNet) String() stringReturn Value
string
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net")
func main() { _, n, e := net.ParseCIDR("192.0.2.0/24"); check(e); fmt.Println(n.String()) }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}