1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-09-16 08:56:19 +02:00

First pass linter cleanup (#603)

* first pass linter cleanup

* address review comments
This commit is contained in:
Doug Lauder
2021-06-21 05:21:42 -04:00
committed by GitHub
parent c4154cd2dd
commit 66975bdfe9
49 changed files with 329 additions and 322 deletions

View File

@@ -1,6 +1,7 @@
package web
import (
"errors"
"fmt"
"net/http"
"net/url"
@@ -24,12 +25,11 @@ type RoutedService interface {
type Server struct {
http.Server
baseURL string
rootPath string
port int
ssl bool
localOnly bool
logger *mlog.Logger
baseURL string
rootPath string
port int
ssl bool
logger *mlog.Logger
}
// NewServer creates a new instance of the webserver.
@@ -81,13 +81,13 @@ func (ws *Server) registerRoutes() {
indexTemplate, err := template.New("index").ParseFiles(path.Join(ws.rootPath, "index.html"))
if err != nil {
ws.logger.Error("Unable to serve the index.html file", mlog.Err(err))
w.WriteHeader(500)
w.WriteHeader(http.StatusInternalServerError)
return
}
err = indexTemplate.ExecuteTemplate(w, "index.html", map[string]string{"BaseURL": ws.baseURL})
if err != nil {
ws.logger.Error("Unable to serve the index.html file", mlog.Err(err))
w.WriteHeader(500)
w.WriteHeader(http.StatusInternalServerError)
return
}
})
@@ -115,7 +115,7 @@ func (ws *Server) Start() {
ws.logger.Info("http server started", mlog.Int("port", ws.port))
go func() {
if err := ws.ListenAndServe(); err != http.ErrServerClosed {
if err := ws.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
ws.logger.Fatal("ListenAndServeTLS", mlog.Err(err))
}
ws.logger.Info("http server stopped")