From 9856d04a200bc92060f8305e9c9f9c1019dcba72 Mon Sep 17 00:00:00 2001 From: Sergey Melnikov Date: Wed, 17 Jan 2024 11:52:59 +0300 Subject: [PATCH] lint --- src/view/api.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/view/api.go b/src/view/api.go index 78f48ee..66782dc 100644 --- a/src/view/api.go +++ b/src/view/api.go @@ -94,12 +94,13 @@ func (a *API) getUser() http.HandlerFunc { // @Failure default {object} structs.ANSWERAPI // @Router /user [post] // writeUser gets json request and write to nosql, without id - create new user -// { -// "firstname":"username", -// "lastname":"username", -// "birthday":"1972-06-10", -// "currentlocation":"Location" -// } +// +// { +// "firstname":"username", +// "lastname":"username", +// "birthday":"1972-06-10", +// "currentlocation":"Location" +// } func (a *API) createUser() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var user *structs.USER @@ -251,5 +252,8 @@ func (a *API) respond(w http.ResponseWriter, r *http.Request, code int, data int if r.Method == "OPTIONS" { return } - _ = json.NewEncoder(w).Encode(setAnswer(data, e, add)) + err := json.NewEncoder(w).Encode(setAnswer(data, e, add)) + if err != nil { + return + } }