Move db variables local to their methods

parent 6781b328
package main
import (
"database/sql"
"flag"
"fmt"
"log"
......@@ -16,8 +15,6 @@ var (
pgUser = flag.String("pgUser", os.Getenv("PGUSER"), "PostgreSQL user")
pgPass = flag.String("pgPass", os.Getenv("PGPASSWORD"), "PostgreSQL password")
pg *sql.DB
vercommit string // Git commit
)
......
......@@ -13,6 +13,8 @@ type Link struct {
Href string `json:"href" xml:"href,attr"`
}
var pg *sql.DB
// InitPgConn initializes the PostgreSQL database connection.
func InitPgConn() {
var err error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment