style(alerting): align quiet hours code and tests with Go style guide
This commit is contained in:
1 parent
ee3769f578
commit
1c31003baf
4 files changed
+162
-94
No files matched your search
@@ -78,14 +78,20 @@ func (s *Server) saveAlertGroup(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
var quietRaw []byte
|
||||
if req.QuietHours != nil {
|
||||
switch {
|
||||
case req.QuietHours != nil:
|
||||
qh, code := validateQuietHours(req.QuietHours)
|
||||
if code != "" {
|
||||
fail(c, http.StatusUnprocessableEntity, code)
|
||||
return
|
||||
}
|
||||
quietRaw, _ = json.Marshal(qh)
|
||||
} else if c.Param("id") == "" {
|
||||
var err error
|
||||
quietRaw, err = json.Marshal(qh)
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
case c.Param("id") == "":
|
||||
quietRaw = []byte("[]")
|
||||
}
|
||||
ctx := c.Request.Context()
|
||||
|
||||
Reference in new issue
Block a user