go fmt
This commit is contained in:
@@ -9,7 +9,7 @@ type conn struct {
|
|||||||
conn net.Conn
|
conn net.Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
func Connect(options map[string] string) (c *conn, err error) {
|
func Connect(options map[string]string) (c *conn, err error) {
|
||||||
c = new(conn)
|
c = new(conn)
|
||||||
|
|
||||||
var present bool
|
var present bool
|
||||||
@@ -17,7 +17,9 @@ func Connect(options map[string] string) (c *conn, err error) {
|
|||||||
|
|
||||||
if socket, present = options["socket"]; present {
|
if socket, present = options["socket"]; present {
|
||||||
c.conn, err = net.Dial("unix", socket)
|
c.conn, err = net.Dial("unix", socket)
|
||||||
if err != nil { return nil, err }
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// conn, err := net.Dial("tcp", "localhost:5432")
|
// conn, err := net.Dial("tcp", "localhost:5432")
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestConnect(t *testing.T) {
|
func TestConnect(t *testing.T) {
|
||||||
_, err := Connect(map[string] string { "socket": "/private/tmp/.s.PGSQL.5432" })
|
_, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Unable to establish connection")
|
t.Fatal("Unable to establish connection")
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,11 +9,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type startupMessage struct {
|
type startupMessage struct {
|
||||||
options map[string] string
|
options map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStartupMessage() *startupMessage {
|
func newStartupMessage() *startupMessage {
|
||||||
return &startupMessage{map[string] string{}}
|
return &startupMessage{map[string]string{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *startupMessage) Bytes() (buf []byte) {
|
func (self *startupMessage) Bytes() (buf []byte) {
|
||||||
|
|||||||
Reference in New Issue
Block a user