From 4f3dfa7cb2368832adef80648f2a4f358846f569 Mon Sep 17 00:00:00 2001 From: Fredrik Thune Date: Mon, 30 Oct 2023 13:58:18 +0100 Subject: [PATCH] Fixes linting for golang v1.21 --- pkg/config/config.go | 3 +-- pkg/http/httpClient.go | 4 ++-- pkg/monitors/gcloud/gcloud-monitor.go | 3 ++- pkg/monitors/statuscake/statuscake-monitor.go | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 4ab1de58e..2f2798d6d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,7 +1,6 @@ package config import ( - "io/ioutil" "os" "strconv" "time" @@ -150,7 +149,7 @@ func ReadConfig(filePath string) Config { var config Config // Read YML log.Info("Reading YAML Configuration: " + filePath) - source, err := ioutil.ReadFile(filePath) + source, err := os.ReadFile(filePath) if err != nil { panic(err) } diff --git a/pkg/http/httpClient.go b/pkg/http/httpClient.go index ef8d31c35..334441a1f 100644 --- a/pkg/http/httpClient.go +++ b/pkg/http/httpClient.go @@ -2,7 +2,7 @@ package http import ( "bytes" - "io/ioutil" + "io" "net/http" logf "sigs.k8s.io/controller-runtime/pkg/log" @@ -56,7 +56,7 @@ func (client *HttpClient) RequestWithHeaders(requestType string, body []byte, he httpResponse := HttpResponse{StatusCode: response.StatusCode} defer response.Body.Close() - responseBytes, _ := ioutil.ReadAll(response.Body) + responseBytes, _ := io.ReadAll(response.Body) httpResponse.Bytes = responseBytes return httpResponse diff --git a/pkg/monitors/gcloud/gcloud-monitor.go b/pkg/monitors/gcloud/gcloud-monitor.go index 6e2e907a9..ea3e0ae89 100644 --- a/pkg/monitors/gcloud/gcloud-monitor.go +++ b/pkg/monitors/gcloud/gcloud-monitor.go @@ -12,7 +12,8 @@ import ( "google.golang.org/api/iterator" "google.golang.org/api/option" monitoredres "google.golang.org/genproto/googleapis/api/monitoredres" - monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + //monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1" "github.com/stakater/IngressMonitorController/v2/pkg/config" diff --git a/pkg/monitors/statuscake/statuscake-monitor.go b/pkg/monitors/statuscake/statuscake-monitor.go index 1bab5c810..9bc95e67e 100644 --- a/pkg/monitors/statuscake/statuscake-monitor.go +++ b/pkg/monitors/statuscake/statuscake-monitor.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "net/url" "os" @@ -372,7 +371,7 @@ func (service *StatusCakeMonitorService) Add(m models.Monitor) { if resp.StatusCode == http.StatusCreated { log.Info("Monitor Added: " + m.Name) } else { - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { log.Error(err, "Unable to read response") os.Exit(1) @@ -406,7 +405,7 @@ func (service *StatusCakeMonitorService) Update(m models.Monitor) { if resp.StatusCode == http.StatusNoContent { log.Info("Monitor Updated: " + m.ID + m.Name) } else { - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { log.Error(err, "Unable to read response") os.Exit(1)