Standard library / net/netip

netip.Addr.Prev()

Return the previous address or an invalid value on underflow. Expected stdout: '192.0.2.6\n'.

Formal Syntax & Structure

go syntaxgo
func (ip Addr) Prev() Addr

Return Value

Addr

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("192.0.2.7").Prev()) }
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