From 614e87d17ced66ff27f86fe98fa1ae4ee08ba237 Mon Sep 17 00:00:00 2001 From: "a.kosourov" Date: Sat, 20 Oct 2018 19:58:14 +0300 Subject: [PATCH] fix linters warnings --- backend/app/rest/api/rest.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/app/rest/api/rest.go b/backend/app/rest/api/rest.go index c47fa7dd..2d377156 100644 --- a/backend/app/rest/api/rest.go +++ b/backend/app/rest/api/rest.go @@ -35,9 +35,14 @@ import ( type sslMode int8 const ( - None sslMode = iota // http server only - Static // both https and http server. Redirect http to https - Auto // both https and http server. Redirect http to https. Https server with autocert support + // None defines to run http server only + None sslMode = iota + + // Static defines to run both https and http server. Redirect http to https + Static + + // Auto defines to run both https and http server. Redirect http to https. Https server with autocert support + Auto ) // SSLConfig holds all params for ssl server mode @@ -104,7 +109,7 @@ func (s *Rest) Run(port int) { s.lock.Lock() s.httpsServer = s.makeHTTPServer(s.SSLConfig.Port, s.routes()) - s.httpServer = s.makeHTTPServer(port, s.httpToHttpsRouter()) + s.httpServer = s.makeHTTPServer(port, s.httpToHTTPSRouter()) s.lock.Unlock() go func() { @@ -155,7 +160,7 @@ func (s *Rest) makeHTTPServer(port int, router chi.Router) *http.Server { } } -func (s *Rest) httpToHttpsRouter() chi.Router { +func (s *Rest) httpToHTTPSRouter() chi.Router { router := chi.NewRouter() router.Use(middleware.RealIP, Recoverer) router.Use(middleware.Throttle(1000), middleware.Timeout(60*time.Second))