Standard library / net

net.IPAddr.String()

Format an IP address and optional zone. Expected stdout: 'fe80::1%demo\n'.

Formal Syntax & Structure

go syntaxgo
func (a *IPAddr) String() string

Return Value

string

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net")
func main() { fmt.Println((&net.IPAddr{IP: net.ParseIP("fe80::1"), Zone: "demo"}).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)  }}
Go Reference