Linting
This commit is contained in:
32
Http/os.go
32
Http/os.go
@@ -20,9 +20,9 @@ func GetOS(w http.ResponseWriter, r *http.Request) {
|
||||
t := time.Now()
|
||||
status := 200
|
||||
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
list, err = db.GetOS(db_conn)
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
list, err = db.GetOS(dbConn)
|
||||
if err != nil {
|
||||
log.Println("Error getting OS list")
|
||||
status = 500
|
||||
@@ -40,14 +40,14 @@ func GetOSbyID(w http.ResponseWriter, r *http.Request) {
|
||||
status := 200
|
||||
|
||||
params := mux.Vars(r)
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
id, err := strconv.ParseInt(params["id"], 10, 64)
|
||||
if err != nil {
|
||||
log.Println("Error converting ID", err)
|
||||
status = 500
|
||||
}
|
||||
os, err = db.GetOSbyID(db_conn, int64(id))
|
||||
os, err = db.GetOSbyID(dbConn, int64(id))
|
||||
if err != nil {
|
||||
log.Println("Error getting OS")
|
||||
status = 500
|
||||
@@ -64,9 +64,9 @@ func GetDistributionList(w http.ResponseWriter, r *http.Request) {
|
||||
t := time.Now()
|
||||
status := 200
|
||||
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
list, err = db.GetDistributionList(db_conn)
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
list, err = db.GetDistributionList(dbConn)
|
||||
if err != nil {
|
||||
log.Println("Error getting distribution list")
|
||||
status = 500
|
||||
@@ -84,9 +84,9 @@ func GetVersionsByDistributionList(w http.ResponseWriter, r *http.Request) {
|
||||
status := 200
|
||||
|
||||
params := mux.Vars(r)
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
list, err = db.GetVersionsByDistributionList(db_conn, params["distribution"])
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
list, err = db.GetVersionsByDistributionList(dbConn, params["distribution"])
|
||||
if err != nil {
|
||||
log.Println("Error getting distribution list")
|
||||
status = 500
|
||||
@@ -112,10 +112,10 @@ func CreateOS(w http.ResponseWriter, r *http.Request) {
|
||||
json.Unmarshal(body, ¶ms)
|
||||
os.Distribution = params["distribution"]
|
||||
os.Version = params["version"]
|
||||
os.End_of_support = params["end_of_support"]
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
err = db.CreateOS(os, db_conn)
|
||||
os.EndOfSupport = params["end_of_support"]
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
err = db.CreateOS(os, dbConn)
|
||||
if err != nil {
|
||||
log.Println("Error creating new OS", err)
|
||||
status = 500
|
||||
|
||||
@@ -38,14 +38,14 @@ func GetPackagebyID(w http.ResponseWriter, r *http.Request) {
|
||||
status := 200
|
||||
|
||||
params := mux.Vars(r)
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
id, err := strconv.ParseInt(params["id"], 10, 64)
|
||||
if err != nil {
|
||||
log.Println("Error converting ID", err)
|
||||
status = 500
|
||||
}
|
||||
pkg, err = db.GetPackagebyID(db_conn, int64(id))
|
||||
pkg, err = db.GetPackagebyID(dbConn, int64(id))
|
||||
if err != nil {
|
||||
log.Println("Error getting Package")
|
||||
status = 500
|
||||
|
||||
@@ -18,9 +18,9 @@ func GetServersList(w http.ResponseWriter, r *http.Request) {
|
||||
t := time.Now()
|
||||
status := 200
|
||||
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
list, err = db.GetServersList(db_conn)
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
list, err = db.GetServersList(dbConn)
|
||||
if err != nil {
|
||||
log.Println("Error getting OS list")
|
||||
status = 500
|
||||
@@ -43,9 +43,9 @@ func GetServersbyID(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("Error converting ID", err)
|
||||
status = 500
|
||||
}
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
server = db.GetServersbyID(db_conn, int64(id))
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
server = db.GetServersbyID(dbConn, int64(id))
|
||||
logRequest(t, r, status)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(server)
|
||||
@@ -59,14 +59,14 @@ func GetServersbyOS(w http.ResponseWriter, r *http.Request) {
|
||||
status := 200
|
||||
|
||||
params := mux.Vars(r)
|
||||
os_id, err := strconv.ParseInt(params["os_id"], 10, 32)
|
||||
osId, err := strconv.ParseInt(params["os_id"], 10, 32)
|
||||
if err != nil {
|
||||
log.Println("Error converting ID", err)
|
||||
status = 500
|
||||
}
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
defer db_conn.Close()
|
||||
servers, err = db.GetServersbyOS(db_conn, int64(os_id))
|
||||
dbConn := db.GetDatabaseConnection()
|
||||
defer dbConn.Close()
|
||||
servers, err = db.GetServersbyOS(dbConn, int64(osId))
|
||||
if err != nil {
|
||||
log.Println("Error getting servers by OS", err)
|
||||
status = 500
|
||||
|
||||
Reference in New Issue
Block a user