From 816ac92fdec10502af23aeba35e395c695ee67f1 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Fri, 19 Jan 2024 06:51:57 +0000 Subject: [PATCH] runner: fix golang-lint issues Signed-off-by: Wei Fu --- runner/server.go | 7 ++++--- runner/utils.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/runner/server.go b/runner/server.go index f71d215..2d03786 100644 --- a/runner/server.go +++ b/runner/server.go @@ -64,6 +64,7 @@ func (s *Server) Run() error { wg.Add(1) go func(l net.Listener) { defer wg.Done() + //nolint:gosec errCh <- http.Serve(l, r) }(lis) } @@ -78,7 +79,7 @@ func (s *Server) Run() error { } // listRunnerGroupsHandler lists all the runner groups. -func (s *Server) listRunnerGroupsHandler(w http.ResponseWriter, r *http.Request) { +func (s *Server) listRunnerGroupsHandler(w http.ResponseWriter, _ *http.Request) { res := make([]*types.RunnerGroup, 0, len(s.groups)) for _, g := range s.groups { res = append(res, g.Info()) @@ -86,7 +87,7 @@ func (s *Server) listRunnerGroupsHandler(w http.ResponseWriter, r *http.Request) data, _ := json.Marshal(res) w.WriteHeader(http.StatusOK) - w.Write(data) + _, _ = w.Write(data) } // getRunnerGroupsSummary returns summary report. @@ -112,7 +113,7 @@ func (s *Server) getRunnerGroupsSummary(w http.ResponseWriter, r *http.Request) data, _ := json.Marshal(s.report) w.WriteHeader(http.StatusOK) - w.Write(data) + _, _ = w.Write(data) } // postRunnerGroupsRunnerResult receives summary result from runner. diff --git a/runner/utils.go b/runner/utils.go index a070cfd..2a7cf2e 100644 --- a/runner/utils.go +++ b/runner/utils.go @@ -30,7 +30,7 @@ func renderErrorResponse(w http.ResponseWriter, code int, err error) { data, _ := json.Marshal(types.HTTPError{ Error: err.Error(), }) - w.Write(data) + _, _ = w.Write(data) } // buildNetListeners returns slice of net.Listeners.