Standard library / net

net.UnixAddr

An address for Unix-domain communication. Name is the socket path or platform-specific address; Net selects unix, unixgram or unixpacket. Constructing an address does not create a socket. Expected stdout: 'demo.sock unix\n'.

Formal Syntax & Structure

go syntaxgo
type UnixAddr struct {  Name string  Net  string}

Working Example

Example Snippetgo
package main
import (  "fmt"  "net")
func main() { a := net.UnixAddr{Name: "demo.sock", Net: "unix"}; fmt.Println(a.Name, a.Net) }
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