Standard library / net
net.IP.To16()
Return a sixteen-byte representation or nil if invalid. Expected stdout: '16\n'.
Formal Syntax & Structure
go syntaxgo
func (ip IP) To16() IPReturn Value
IP
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net")
func main() { fmt.Println(len(net.ParseIP("192.0.2.7").To16())) }
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) }}