Standard library / net/netip

netip.Addr.StringExpanded()

Render IPv6 without compression and with leading zeroes. Expected stdout: '2001:0db8:0000:0000:0000:0000:0000:0001\n'.

Formal Syntax & Structure

go syntaxgo
func (ip Addr) StringExpanded() string

Return Value

string

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/netip")
func main() { fmt.Println(netip.MustParseAddr("2001:db8::1").StringExpanded()) }
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)  }}
Go Reference