github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/net/netip/export_test.go (about)

     1  //go:build js
     2  // +build js
     3  
     4  package netip
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"internal/intern"
    10  )
    11  
    12  func MkAddr(u Uint128, z any) Addr {
    13  	switch z := z.(type) {
    14  	case *intern.Value:
    15  		return Addr{u, z.Get().(string)}
    16  	case string:
    17  		return Addr{u, z}
    18  	default:
    19  		panic(fmt.Errorf("unexpected type %T of the z argument"))
    20  	}
    21  }