Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated io/ioutil package reference from goscaleio #80

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
"io"
"math"
"net/http"
"os"
Expand Down Expand Up @@ -53,7 +53,7 @@
}

// Cluster defines struct for Cluster
type Cluster struct {

Check failure on line 56 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
}

// ConfigConnect defines struct for ConfigConnect
Expand All @@ -73,7 +73,7 @@

// GetVersion returns version
func (c *Client) GetVersion() (string, error) {

Check failure on line 76 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
resp, err := c.api.DoAndGetResponseBody(
context.Background(), http.MethodGet, "/api/version", nil, nil, c.configConnect.Version)
if err != nil {
Expand Down Expand Up @@ -108,7 +108,7 @@

// updateVersion updates version
func (c *Client) updateVersion() error {

Check failure on line 111 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
version, err := c.GetVersion()
if err != nil {
return err
Expand All @@ -132,7 +132,7 @@

// Authenticate controls authentication to client
func (c *Client) Authenticate(configConnect *ConfigConnect) (Cluster, error) {

Check failure on line 135 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
configConnect.Version = c.configConnect.Version
c.configConnect = configConnect

Expand Down Expand Up @@ -187,7 +187,7 @@

func (c *Client) getJSONWithRetry(
method, uri string,
body, resp interface{}) error {

Check failure on line 190 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

headers := make(map[string]string, 2)
headers[api.HeaderKeyAccept] = accHeader
Expand Down Expand Up @@ -219,7 +219,7 @@
}

func extractString(resp *http.Response) (string, error) {
bs, err := ioutil.ReadAll(resp.Body)
bs, err := io.ReadAll(resp.Body)
if err != nil {
return "", errBodyRead
}
Expand All @@ -240,7 +240,7 @@

func (c *Client) getStringWithRetry(
method, uri string,
body interface{}) (string, error) {

Check failure on line 243 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

headers := make(map[string]string, 2)
headers[api.HeaderKeyAccept] = accHeader
Expand Down Expand Up @@ -333,7 +333,7 @@
version string,
timeout int64,
insecure,
useCerts bool) (client *Client, err error) {

Check failure on line 336 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

if showHTTP {
debug = true
Expand Down Expand Up @@ -401,7 +401,7 @@
}

func withFieldsE(
fields map[string]interface{}, message string, inner error) error {

Check failure on line 404 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

if fields == nil {
fields = make(map[string]interface{})
Expand Down Expand Up @@ -429,7 +429,7 @@

func doLog(
l func(args ...interface{}),
msg string) {

Check failure on line 432 in api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

if debug {
l(msg)
Expand Down
3 changes: 1 addition & 2 deletions api/api_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httputil"
"strings"
Expand All @@ -31,7 +30,7 @@
}

func logRequest(
ctx context.Context,

Check warning on line 33 in api/api_logging.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
req *http.Request,
lf func(func(args ...interface{}), string)) {

Expand Down Expand Up @@ -60,9 +59,9 @@
}

func logResponse(
ctx context.Context,

Check warning on line 62 in api/api_logging.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
res *http.Response,
lf func(func(args ...interface{}), string)) {

Check warning on line 64 in api/api_logging.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'lf' seems to be unused, consider removing or renaming it as _ (revive)

log.SetLevel(log.DebugLevel)

Expand Down Expand Up @@ -146,7 +145,7 @@
if err = b.Close(); err != nil {
return nil, b, err
}
return ioutil.NopCloser(&buf), ioutil.NopCloser(bytes.NewReader(buf.Bytes())), nil
return io.NopCloser(&buf), io.NopCloser(bytes.NewReader(buf.Bytes())), nil
}

func dumpRequest(req *http.Request, body bool) ([]byte, error) {
Expand Down
3 changes: 1 addition & 2 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -202,7 +201,7 @@
}
}

func Test_updateHeaders(t *testing.T) {

Check warning on line 204 in api_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
var wg sync.WaitGroup
for i := 0; i < 3; i++ {
wg.Add(1)
Expand Down Expand Up @@ -305,7 +304,7 @@

func testReadAll(t *testing.T, rc io.ReadCloser) []byte {
t.Helper()
b, err := ioutil.ReadAll(rc)
b, err := io.ReadAll(rc)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package goscaleio
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"regexp"
"sort"
Expand Down Expand Up @@ -161,7 +161,7 @@ func getVolumeMapping(sysID string, volID string) (mappedVolumes []*SdcMappedVol
mappedVolumesMap := make(map[string]*SdcMappedVolume)

diskIDPath := FSDevDirectoryPrefix + "/dev/disk/by-id"
files, _ := ioutil.ReadDir(diskIDPath)
files, _ := os.ReadDir(diskIDPath)
strRegex := fmt.Sprintf(`^emc-vol-%s-%s$`, sysID, volID)
r, _ := regexp.Compile(strRegex)
for _, f := range files {
Expand Down
Loading