github.com/traefik/yaegi@v0.15.1/_test/ptr7.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"net"
     6  	"strings"
     7  )
     8  
     9  type ipNetValue net.IPNet
    10  
    11  func (ipnet *ipNetValue) Set(value string) error {
    12  	_, n, err := net.ParseCIDR(strings.TrimSpace(value))
    13  	if err != nil {
    14  		return err
    15  	}
    16  	*ipnet = ipNetValue(*n)
    17  	return nil
    18  }
    19  
    20  func main() {
    21  	v := ipNetValue{}
    22  	fmt.Println(v)
    23  }
    24  
    25  // Output:
    26  // {<nil> <nil>}