From ffb0d1b8a51602b920a09ab862a5deaa289525be Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Tue, 26 Jul 2022 22:45:38 -0700 Subject: [PATCH] applying go fmt --- net/server/internal/authUtil.go | 18 +++++++++--------- net/server/internal/httpUtil.go | 1 - net/server/internal/logger.go | 6 +++--- net/server/internal/models.go | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/net/server/internal/authUtil.go b/net/server/internal/authUtil.go index 5cfa3e50..0f18aa26 100644 --- a/net/server/internal/authUtil.go +++ b/net/server/internal/authUtil.go @@ -111,14 +111,14 @@ func ParamAgentToken(r *http.Request, detail bool) (*store.Account, int, error) if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } else { if err := store.DB.Preload("Account").Where("account_id = ? AND token = ?", target, access).First(&app).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } if app.Account.Disabled { @@ -128,7 +128,7 @@ func ParamAgentToken(r *http.Request, detail bool) (*store.Account, int, error) return &app.Account, http.StatusOK, nil } -//BearerAppToken retrieves account specified by authorization header +//BearerAppToken retrieves account specified by authorization header func BearerAppToken(r *http.Request, detail bool) (*store.Account, int, error) { // parse bearer authentication @@ -146,14 +146,14 @@ func BearerAppToken(r *http.Request, detail bool) (*store.Account, int, error) { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } else { if err := store.DB.Preload("Account").Where("account_id = ? AND token = ?", target, access).First(&app).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } if app.Account.Disabled { @@ -209,14 +209,14 @@ func ParamContactToken(r *http.Request, detail bool) (*store.Card, int, error) { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } else { if err := store.DB.Preload("CardSlot").Preload("Account").Where("account_id = ? AND in_token = ?", target, access).First(&card).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } if card.Account.Disabled { @@ -247,14 +247,14 @@ func BearerContactToken(r *http.Request, detail bool) (*store.Card, int, error) if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } else { if err := store.DB.Preload("Account").Where("account_id = ? AND in_token = ?", target, access).First(&card).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, http.StatusNotFound, err } - return nil, http.StatusInternalServerError, err + return nil, http.StatusInternalServerError, err } } if card.Account.Disabled { diff --git a/net/server/internal/httpUtil.go b/net/server/internal/httpUtil.go index 5bd3b3fc..38bfca9a 100644 --- a/net/server/internal/httpUtil.go +++ b/net/server/internal/httpUtil.go @@ -64,4 +64,3 @@ func ParseRequest(r *http.Request, w http.ResponseWriter, obj interface{}) error dec.DisallowUnknownFields() return dec.Decode(&obj) } - diff --git a/net/server/internal/logger.go b/net/server/internal/logger.go index 2cd60bf3..03743e58 100644 --- a/net/server/internal/logger.go +++ b/net/server/internal/logger.go @@ -48,9 +48,9 @@ func ErrMsg(err error) { //LogMsg prints detailed error string func LogMsg(msg string) { - _, file, line, _ := runtime.Caller(1) - p, _ := os.Getwd() - log.Printf("%s:%d %s", strings.TrimPrefix(file, p), line, msg) + _, file, line, _ := runtime.Caller(1) + p, _ := os.Getwd() + log.Printf("%s:%d %s", strings.TrimPrefix(file, p), line, msg) } //PrintMsg prints debug message diff --git a/net/server/internal/models.go b/net/server/internal/models.go index 48bdcd6f..0ea0fb98 100644 --- a/net/server/internal/models.go +++ b/net/server/internal/models.go @@ -445,4 +445,3 @@ type TopicDetail struct { Transform string `json:"transform,omitempty"` } -