]> Cypherpunks repositories - gostls13.git/commitdiff
net: fix documentation for UnixAddr
authorMikio Hara <mikioh.mikioh@gmail.com>
Fri, 22 Mar 2013 22:39:43 +0000 (07:39 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Fri, 22 Mar 2013 22:39:43 +0000 (07:39 +0900)
Also simplifies ResolveUnixAddr.

R=golang-dev, dave, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7510047

src/pkg/net/unixsock.go

index ae0956958f3655a0781aa614ad1b77876e72e372..977ff91031c672de87cc6751b0fd37e33aca54de 100644 (file)
@@ -12,7 +12,8 @@ type UnixAddr struct {
        Net  string
 }
 
-// Network returns the address's network name, "unix" or "unixgram".
+// Network returns the address's network name, "unix", "unixgram" or
+// "unixpacket".
 func (a *UnixAddr) Network() string {
        return a.Net
 }
@@ -36,11 +37,9 @@ func (a *UnixAddr) toAddr() Addr {
 // "unixpacket".
 func ResolveUnixAddr(net, addr string) (*UnixAddr, error) {
        switch net {
-       case "unix":
-       case "unixpacket":
-       case "unixgram":
+       case "unix", "unixgram", "unixpacket":
+               return &UnixAddr{Name: addr, Net: net}, nil
        default:
                return nil, UnknownNetworkError(net)
        }
-       return &UnixAddr{addr, net}, nil
 }