server.go
func (s *Server) ListenAndServeUNIX(addr string, mode os.FileMode) error {
	if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
		return fmt.Errorf("unexpected error when trying to remove unix socket file %q: %s", addr, err)
	}
	ln, err := net.Listen("unix", addr)
	if err != nil {
		return err
	}
	if err = os.Chmod(addr, mode); err != nil {
		return fmt.Errorf("cannot chmod %#o for %q: %s", mode, addr, err)
	}
	return s.Serve(ln)
}
func (s *Server) ListenAndServeUNIX(addr string, mode os.FileMode) error {
	if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
		return fmt.Errorf("unexpected error when trying to remove unix socket file %q: %s", addr, err)
	}
	ln, err := net.Listen("unix", addr)
	if err != nil {
		return err
	}
	if err = os.Chmod(addr, mode); err != nil {
		return fmt.Errorf("cannot chmod %#o for %q: %s", mode, addr, err)
	}
	return s.Serve(ln)
}
func ( s * Server ) ListenAndServeUNIX ( addr string , mode os . FileMode ) error { if err := os . Remove ( addr ) ; err != nil && ! os . IsNotExist ( err ) { return fmt . Errorf ( " " , addr , err ) } ln , err := net . Listen ( " " , addr ) if err != nil { return err } if err = os . Chmod ( addr , mode ) ; err != nil { return fmt . Errorf ( " " , mode , addr , err ) } return s . Serve ( ln ) }
// ListenAndServeUNIX serves HTTP requests from the given UNIX addr.
//
// The function deletes existing file at addr before starting serving.
//
// The server sets the given file mode for the UNIX addr.
ListenAndServeUNIX serves HTTP requests from the given UNIX addr . The function deletes existing file at addr before starting serving . The server sets the given file mode for the UNIX addr .