Standard library / net
net.ResolveUnixAddr()
Construct a Unix address for unix, unixgram or unixpacket. This does not connect or prove that a socket exists. Expected stdout: 'unix demo.sock\n'.
Formal Syntax & Structure
go syntaxgo
func ResolveUnixAddr(network, address string) (*UnixAddr, error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| network | string | Network family such as tcp4 or udp4. |
| address | string | Network address including port when required. |
Return Value
(*UnixAddr, error)
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net")
func main() { a := must(net.ResolveUnixAddr("unix", "demo.sock")) fmt.Println(a.Network(), a.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) }}