Skip to content

Commit

Permalink
Replace deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
Mongey committed Oct 18, 2022
1 parent a91ec04 commit 05b8c13
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
"os"
"time"

"github.com/Shopify/sarama"
Expand Down Expand Up @@ -91,7 +91,7 @@ func parsePemOrLoadFromFile(input string) (*pem.Block, []byte, error) {
//attempt to load from file
log.Printf("[INFO] Attempting to load from file '%s'", input)
var err error
inputBytes, err = ioutil.ReadFile(input)
inputBytes, err = os.ReadFile(input)
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions kafka/config_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package kafka

import (
"io/ioutil"
"os"
"testing"
)

func loadFile(t *testing.T, file string) string {
fb, err := ioutil.ReadFile(file)
fb, err := os.ReadFile(file)
if err != nil {
t.Fatalf("[ERROR] Error reading file %s", err)
}
Expand Down
10 changes: 5 additions & 5 deletions kafka/resource_kafka_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package kafka

import (
"fmt"
"io/ioutil"
"log"
"os"
"testing"

"github.com/Shopify/sarama"
Expand Down Expand Up @@ -194,17 +194,17 @@ resource "kafka_acl" "test" {
}
`

//lintignore:AT004
// lintignore:AT004
func cfg(t *testing.T, bs string, extraCfg string) string {
_, err := ioutil.ReadFile("../secrets/ca.crt")
_, err := os.ReadFile("../secrets/ca.crt")
if err != nil {
t.Fatal(err)
}
_, err = ioutil.ReadFile("../secrets/terraform-cert.pem")
_, err = os.ReadFile("../secrets/terraform-cert.pem")
if err != nil {
t.Fatal(err)
}
_, err = ioutil.ReadFile("../secrets/terraform.pem")
_, err = os.ReadFile("../secrets/terraform.pem")
if err != nil {
t.Fatal(err)
}
Expand Down
14 changes: 7 additions & 7 deletions tls-debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"os"

"github.com/Mongey/terraform-provider-kafka/kafka"
"github.com/Shopify/sarama"
Expand All @@ -21,17 +21,17 @@ func main() {

func client(broker, caLocation, clientCertLocation, clientKeyLocation string) (*sarama.Client, error) {
brokers := []string{broker}
caCert, err := ioutil.ReadFile(caLocation)
caCert, err := os.ReadFile(caLocation)
if err != nil {
return nil, err
}

clientCert, err := ioutil.ReadFile(clientCertLocation)
clientCert, err := os.ReadFile(clientCertLocation)
if err != nil {
return nil, err
}

clientKey, err := ioutil.ReadFile(clientKeyLocation)
clientKey, err := os.ReadFile(clientKeyLocation)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -82,17 +82,17 @@ func fauxMain() error {
return err
}
} else {
caCert, err := ioutil.ReadFile(*ca)
caCert, err := os.ReadFile(*ca)
if err != nil {
return err
}

clientCert, err := ioutil.ReadFile(*cert)
clientCert, err := os.ReadFile(*cert)
if err != nil {
return err
}

clientKey, err := ioutil.ReadFile(*key)
clientKey, err := os.ReadFile(*key)
if err != nil {
return err
}
Expand Down

0 comments on commit 05b8c13

Please sign in to comment.