package main

import (
	"fmt"

	"github.com/jmoiron/sqlx"
	_ "github.com/lib/pq"
)

const (
	DBHOST   string = "localhost"
	DATABASE string = "lms2_development"
	DBUSER   string = "lms"
	DBPASS   string = ""
	SSLMODE  string = "disable"
)

var DBUrl string = fmt.Sprintf(
	"postgres://%s:%s@%s/%s?sslmode=%s",
	DBUSER, DBPASS, DBHOST, DATABASE, SSLMODE)

func NewDBConn() (db *sqlx.DB) {
	db, err := sqlx.Connect("postgres", DBUrl)
	if err != nil {
		fmt.Println(err)
		return nil
	}

	return
}

package main

import (
	"database/sql"
	"fmt"

	_ "github.com/lib/pq"
)

const (
	DBHOST   string = "localhost"
	DATABASE string = "lms2_db_dev"
	DBUSER   string = "lms2_db_user"
	DBPASS   string = "lms_2014"
	SSLMODE  string = "disable"
)

var DBUrl string = fmt.Sprintf(
	"postgres://%s:%s@%s/%s?sslmode=%s",
	DBUSER, DBPASS, DBHOST, DATABASE, SSLMODE)

func NewDBConn() (db *sql.DB) {
	db, err := sql.Open("postgres", DBUrl)
	if err != nil {
		fmt.Println(err)
		return nil
	}

	return
}

Switch to builtin database/sql driver
Switch to builtin database/sql driver
