gofmt format fixes
This commit is contained in:
parent
ff98ddf6da
commit
031d97fb2a
@ -8,6 +8,7 @@ import (
|
|||||||
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/database"
|
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/database"
|
||||||
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/models"
|
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/models"
|
||||||
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/utils"
|
"git.cromer.cl/Proyecto-Titulo/alai-server/backend/utils"
|
||||||
|
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ func CreateOS(writer http.ResponseWriter, request *http.Request, params httprout
|
|||||||
decoder := json.NewDecoder(request.Body)
|
decoder := json.NewDecoder(request.Body)
|
||||||
|
|
||||||
err := decoder.Decode(&os)
|
err := decoder.Decode(&os)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -80,13 +81,13 @@ func UpdateOS(writer http.ResponseWriter, request *http.Request, params httprout
|
|||||||
decoder := json.NewDecoder(request.Body)
|
decoder := json.NewDecoder(request.Body)
|
||||||
|
|
||||||
err := decoder.Decode(&os)
|
err := decoder.Decode(&os)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
os.ID, err = strconv.ParseUint(params.ByName("id"), 10, 64)
|
os.ID, err = strconv.ParseUint(params.ByName("id"), 10, 64)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func Login(writer http.ResponseWriter, request *http.Request, params httprouter.
|
|||||||
decoder := json.NewDecoder(request.Body)
|
decoder := json.NewDecoder(request.Body)
|
||||||
|
|
||||||
err := decoder.Decode(&receivedUser)
|
err := decoder.Decode(&receivedUser)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ func CreateUser(writer http.ResponseWriter, request *http.Request, params httpro
|
|||||||
decoder := json.NewDecoder(request.Body)
|
decoder := json.NewDecoder(request.Body)
|
||||||
|
|
||||||
err := decoder.Decode(&user)
|
err := decoder.Decode(&user)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -140,13 +140,13 @@ func UpdateUser(writer http.ResponseWriter, request *http.Request, params httpro
|
|||||||
decoder := json.NewDecoder(request.Body)
|
decoder := json.NewDecoder(request.Body)
|
||||||
|
|
||||||
err := decoder.Decode(&user)
|
err := decoder.Decode(&user)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user.ID, err = strconv.ParseUint(params.ByName("id"), 10, 64)
|
user.ID, err = strconv.ParseUint(params.ByName("id"), 10, 64)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
utils.JSONErrorOutput(writer, http.StatusBadRequest, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,18 @@ func Serve(router *httprouter.Router) {
|
|||||||
|
|
||||||
// Listen for CTRL-C(SIGTERM)
|
// Listen for CTRL-C(SIGTERM)
|
||||||
sigterm := make(chan os.Signal)
|
sigterm := make(chan os.Signal)
|
||||||
signal.Notify(sigterm, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(sigterm, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-sigterm
|
<-sigterm
|
||||||
// When CTRL-C is pressed shutdown the server
|
// When CTRL-C is pressed shutdown the server
|
||||||
if err := server.Shutdown(context.Background()); err != nil {
|
if err := server.Shutdown(context.Background()); err != nil {
|
||||||
log.Printf("HTTP server Shutdown: %v", err)
|
log.Printf("HTTP server Shutdown: %v", err)
|
||||||
}
|
}
|
||||||
close(idleConnsClosed)
|
close(idleConnsClosed)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Run the server
|
// Run the server
|
||||||
if err := server.ListenAndServe(); err != http.ErrServerClosed {
|
if err := server.ListenAndServe(); err != http.ErrServerClosed {
|
||||||
log.Fatalf("HTTP server ListenAndServe: %v", err)
|
log.Fatalf("HTTP server ListenAndServe: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user