resolve linter issues

This commit is contained in:
David Christofas
2021-02-24 14:04:05 +01:00
parent 3328f9acb7
commit 878e465c52
5 changed files with 23 additions and 7 deletions
+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
@@ -47,7 +47,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
+9 -3
View File
@@ -55,9 +55,15 @@ func (p GraphExplorer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (p GraphExplorer) ConfigJs(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/javascript")
w.WriteHeader(http.StatusOK)
io.WriteString(w, fmt.Sprintf("window.ClientId = \"%v\";", p.config.GraphExplorer.ClientID))
io.WriteString(w, fmt.Sprintf("window.Iss = \"%v\";", p.config.GraphExplorer.Issuer))
io.WriteString(w, fmt.Sprintf("window.GraphUrl = \"%v\";", p.config.GraphExplorer.GraphURL))
if _, err := io.WriteString(w, fmt.Sprintf("window.ClientId = \"%v\";", p.config.GraphExplorer.ClientID)); err != nil {
p.logger.Error().Err(err).Msg("Could not write to response writer")
}
if _, err := io.WriteString(w, fmt.Sprintf("window.Iss = \"%v\";", p.config.GraphExplorer.Issuer)); err != nil {
p.logger.Error().Err(err).Msg("Could not write to response writer")
}
if _, err := io.WriteString(w, fmt.Sprintf("window.GraphUrl = \"%v\";", p.config.GraphExplorer.GraphURL)); err != nil {
p.logger.Error().Err(err).Msg("Could not write to response writer")
}
}
// Static simply serves all static files.