From fac0ec26bd74ba1073e96c90b64a2a7da89f22ca Mon Sep 17 00:00:00 2001 From: Don Khan Date: Tue, 22 Aug 2023 20:43:48 -0400 Subject: [PATCH] Remove dependence on io/ioutil, update Go to 1.21 (#54) --- go.mod | 2 +- go.sum | 1 + internal/common/common.go | 4 ++-- opentelemetry/tracers/zipkin_tracer.go | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e062dc7..da291e8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/dell/csm-metrics-powerstore -go 1.20 +go 1.21 require ( github.com/dell/gocsi v1.7.0 diff --git a/go.sum b/go.sum index 8e759cc..de31743 100644 --- a/go.sum +++ b/go.sum @@ -244,6 +244,7 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc= +github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= diff --git a/internal/common/common.go b/internal/common/common.go index c071b1f..00e6e99 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -20,7 +20,7 @@ import ( "context" "errors" "fmt" - "io/ioutil" + "os" "path/filepath" "regexp" "strconv" @@ -48,7 +48,7 @@ func GetPowerStoreArrays(filePath string, logger *logrus.Logger) (map[string]*se Arrays []*service.PowerStoreArray `yaml:"arrays"` } - data, err := ioutil.ReadFile(filepath.Clean(filePath)) + data, err := os.ReadFile(filepath.Clean(filePath)) if err != nil { logger.WithError(err).Errorf("cannot read file %s", filePath) return nil, nil, nil, err diff --git a/opentelemetry/tracers/zipkin_tracer.go b/opentelemetry/tracers/zipkin_tracer.go index f709e48..42082a5 100644 --- a/opentelemetry/tracers/zipkin_tracer.go +++ b/opentelemetry/tracers/zipkin_tracer.go @@ -18,7 +18,7 @@ package tracer import ( "context" - "io/ioutil" + "io" "strings" "go.opentelemetry.io/otel" @@ -36,7 +36,7 @@ func InitTracing(uri string, prob float64) (trace.TracerProvider, error) { } exporter, err := zipkin.New( uri, - zipkin.WithLogger(stdLog.New(ioutil.Discard, "", stdLog.LstdFlags)), + zipkin.WithLogger(stdLog.New(io.Discard, "", stdLog.LstdFlags)), ) if err != nil { return nil, err