Skip to content

Commit e44f39c

Browse files
chore: replace deprecated io/ioutil with io and os packages
Signed-off-by: puneeth_aditya_5656 <myakampuneeth@gmail.com>
1 parent 38fba26 commit e44f39c

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

pkg/config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"crypto/tls"
2020
"crypto/x509"
2121
"fmt"
22-
"io/ioutil"
2322
"net/http"
2423
"net/http/httputil"
2524
"os"
@@ -54,7 +53,7 @@ func CreateTLSConfig() *tls.Config {
5453
sepCaFiles := strings.Split(CaCertPaths, ",")
5554
for _, f := range sepCaFiles {
5655
// Read in the cert file
57-
certs, err := ioutil.ReadFile(f)
56+
certs, err := os.ReadFile(f)
5857
if err != nil {
5958
fmt.Println("Unable to read cert file from CaCertPaths: " + f)
6059
}

pkg/connectors/keycloak_client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"encoding/base64"
2121
"encoding/json"
2222
"fmt"
23-
"io/ioutil"
23+
"io"
2424
"net/http"
2525
"net/url"
2626
"strings"
@@ -95,7 +95,7 @@ func (c *keycloakClient) ConnectAndGetToken() (string, error) {
9595
// Dump response if verbose required.
9696
config.DumpResponseIfRequired("Keycloak for getting token", resp, true)
9797

98-
body, err := ioutil.ReadAll(resp.Body)
98+
body, err := io.ReadAll(resp.Body)
9999
if err != nil {
100100
panic(err.Error())
101101
}
@@ -125,7 +125,7 @@ func (c *keycloakClient) GetOIDCConfig() (*oauth2.Config, error) {
125125
}
126126
defer resp.Body.Close()
127127

128-
body, err := ioutil.ReadAll(resp.Body)
128+
body, err := io.ReadAll(resp.Body)
129129
if err != nil {
130130
panic(err.Error())
131131
}
@@ -172,7 +172,7 @@ func (c *keycloakClient) ConnectAndGetTokenAndRefreshToken(username, password st
172172
}
173173
defer resp.Body.Close()
174174

175-
body, err := ioutil.ReadAll(resp.Body)
175+
body, err := io.ReadAll(resp.Body)
176176
if err != nil {
177177
panic(err.Error())
178178
}

pkg/connectors/microcks_client.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
errs "errors"
2424
"fmt"
2525
"io"
26-
"io/ioutil"
2726
"log"
2827
"mime/multipart"
2928
"net/http"
@@ -227,7 +226,7 @@ func (c *microcksClient) GetKeycloakURL() (string, error) {
227226
// Dump request if verbose required.
228227
config.DumpResponseIfRequired("Microcks for getting Keycloak config", resp, true)
229228

230-
body, err := ioutil.ReadAll(resp.Body)
229+
body, err := io.ReadAll(resp.Body)
231230
if err != nil {
232231
panic(err.Error())
233232
}
@@ -366,7 +365,7 @@ func (c *microcksClient) CreateTestResult(serviceID string, testEndpoint string,
366365
// Dump response if verbose required.
367366
config.DumpResponseIfRequired("Microcks for creating test", resp, true)
368367

369-
body, err := ioutil.ReadAll(resp.Body)
368+
body, err := io.ReadAll(resp.Body)
370369
if err != nil {
371370
panic(err.Error())
372371
}
@@ -405,7 +404,7 @@ func (c *microcksClient) GetTestResult(testResultID string) (*TestResultSummary,
405404
// Dump response if verbose required.
406405
config.DumpResponseIfRequired("Microcks for getting status test", resp, true)
407406

408-
body, err := ioutil.ReadAll(resp.Body)
407+
body, err := io.ReadAll(resp.Body)
409408
if err != nil {
410409
panic(err.Error())
411410
}

0 commit comments

Comments
 (0)