If I open a connection with a valid connection string but with wrong information (wrong password, wrong db name), it returns an error message as expect.
However, if I try to open a connection with a totally invalid connection string, for example conn, errConn := sql.Open("firebirdsql", "aaaaaaa") and then attempt to test it with errPing := conn.Ping(), the code breaks and I get a bunch of errors in the command line and everything after the Ping() gets ignored.
If I open a connection with a valid connection string but with wrong information (wrong password, wrong db name), it returns an error message as expect.
However, if I try to open a connection with a totally invalid connection string, for example
conn, errConn := sql.Open("firebirdsql", "aaaaaaa")
and then attempt to test it witherrPing := conn.Ping()
, the code breaks and I get a bunch of errors in the command line and everything after the Ping() gets ignored.Log:
017/09/01 10:49:53 http: panic serving 192.168.1.73:63073: runtime error: invalid memory address or nil pointer dereference goroutine 36 [running]: net/http.(conn).serve.func1(0xc420138140) /usr/local/go/src/net/http/server.go:1721 +0xd0 panic(0x12c5020, 0x1777f00) /usr/local/go/src/runtime/panic.go:489 +0x2cf github.com/nakagami/firebirdsql.parseDSN(0x1318288, 0x7, 0xc420047578, 0x103264e, 0xc42014c000, 0x200000003, 0xc42014c000, 0xc420022600, 0xc4200475d8, 0x106f3a1, ...) /Users/igorsousa/Sites/WorkingStash/go/src/github.com/nakagami/firebirdsql/utils.go:234 +0xb7 github.com/nakagami/firebirdsql.newFirebirdsqlConn(0x1318288, 0x7, 0x0, 0x200000000, 0x20140000) /Users/igorsousa/Sites/WorkingStash/go/src/github.com/nakagami/firebirdsql/connection.go:103 +0x50 github.com/nakagami/firebirdsql.(firebirdsqlDriver).Open(0x179e400, 0x1318288, 0x7, 0x0, 0xc420175b00, 0x28, 0x28) /Users/igorsousa/Sites/WorkingStash/go/src/github.com/nakagami/firebirdsql/driver.go:34 +0x35 database/sql.(DB).conn(0xc420138280, 0x1468c40, 0xc420072330, 0x1, 0x28, 0x900, 0x1781f60) /usr/local/go/src/database/sql/sql.go:965 +0x146 database/sql.(DB).PingContext(0xc420138280, 0x1468c40, 0xc420072330, 0x0, 0x0) /usr/local/go/src/database/sql/sql.go:593 +0x60 database/sql.(DB).Ping(0xc420138280, 0x1, 0x1) /usr/local/go/src/database/sql/sql.go:615 +0x43 main.startConn(0x14684c0, 0xc4201460e0, 0x4, 0xc42013e1b0, 0xa) /Users/igorsousa/Sites/WorkingStash/go/src/estado_documento/estadodocumento.go:110 +0x1cc main.listarOpHandler(0x14684c0, 0xc4201460e0, 0xc420180000) /Users/igorsousa/Sites/WorkingStash/go/src/estado_documento/estadodocumento.go:209 +0xca net/http.HandlerFunc.ServeHTTP(0x1336500, 0x14684c0, 0xc4201460e0, 0xc420180000) /usr/local/go/src/net/http/server.go:1942 +0x44 net/http.(ServeMux).ServeHTTP(0x1781ca0, 0x14684c0, 0xc4201460e0, 0xc420180000) /usr/local/go/src/net/http/server.go:2238 +0x130 net/http.serverHandler.ServeHTTP(0xc4200b42c0, 0x14684c0, 0xc4201460e0, 0xc420180000) /usr/local/go/src/net/http/server.go:2568 +0x92 net/http.(conn).serve(0xc420138140, 0x1468c00, 0xc420142280) /usr/local/go/src/net/http/server.go:1825 +0x612 created by net/http.(Server).Serve /usr/local/go/src/net/http/server.go:2668 +0x2ce