resolve linter issues

This commit is contained in:
David Christofas
2021-02-25 14:45:19 +01:00
parent 0802e8aac3
commit ee161b2359
6 changed files with 23 additions and 6 deletions
+4 -1
View File
@@ -145,7 +145,10 @@ func Server(cfg *config.Config) *cli.Command {
logger.Err(err).Msg("error opening config file")
return err
}
json.Unmarshal(contents, &cfg.Web.Config)
if err := json.Unmarshal(contents, &cfg.Web.Config); err != nil {
logger.Fatal().Err(err).Msg("error unmarshalling config file")
return err
}
}
var (
+6 -2
View File
@@ -34,7 +34,9 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
// TODO(tboerger): check if services are up and running
io.WriteString(w, http.StatusText(http.StatusOK))
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
panic(err)
}
}
}
@@ -46,6 +48,8 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
// TODO(tboerger): check if services are up and running
io.WriteString(w, http.StatusText(http.StatusOK))
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
panic(err)
}
}
}
+3 -1
View File
@@ -49,7 +49,9 @@ func Server(opts ...Option) (http.Service, error) {
handle = svc.NewTracing(handle)
}
micro.RegisterHandler(service.Server(), handle)
if err := micro.RegisterHandler(service.Server(), handle); err != nil {
return http.Service{}, err
}
service.Init()
return service, nil
+3 -1
View File
@@ -121,7 +121,9 @@ func (p Web) Config(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(payload)
if _, err := w.Write(payload); err != nil {
p.logger.Error().Err(err).Msg("could not write config response")
}
}
// Static simply serves all static files.