The Postgresql server expects the client to end the connection by first sending a Termination message ('X') followed up by closing the socket. The server logs a "unexpected EOF on client connection" warning if the socket is closed without the preceding Termination message.
Use these to make the tests less dependent fewer compiled-in defaults that cannot be overridden. By default, the database "pqgotest" is used for tests now. Unlike libpq, "localhost" is used by default instead of the socket directory, because there is a large split between vanilla PostgreSQL (which places things in /tmp) and the way most packaged PostgreSQL places the unix socket (/var/run/postgresql). Also unlike libpq, we do not have the advantage of the default configuration on the system being burned into the driver, so "localhost" seems like a reasonable compromise. A way to overcome that might be to call out to pg_config or link against libpq, but that is not very good from a dependency perspective and defeats the point of implementing a driver. To run tests, for example, one can now write: $ PGHOST=/var/run/postgresql/ go test pq Signed-off-by: Dan Farina <firstname.lastname@example.org>