Skip to content

Commit

Permalink
Upgrade to go1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzhuojie committed Aug 26, 2022
1 parent ea716e1 commit e398efe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/handler/data_recorder_kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"os"
"strings"
"time"

Expand Down Expand Up @@ -97,7 +97,7 @@ func createTLSConfiguration(certFile string, keyFile string, caFile string, veri
logrus.WithField("TLSConfigurationError", err).Panic(err)
}

caCert, err := ioutil.ReadFile(caFile)
caCert, err := os.ReadFile(caFile)
if err != nil {
logrus.WithField("TLSConfigurationError", err).Panic(err)
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/handler/eval_cache_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package handler
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"

"github.com/openflagr/flagr/pkg/config"
"github.com/openflagr/flagr/pkg/entity"
Expand Down Expand Up @@ -96,7 +97,7 @@ type jsonFileFetcher struct {
}

func (ff *jsonFileFetcher) fetch() ([]entity.Flag, error) {
b, err := ioutil.ReadFile(ff.filePath)
b, err := os.ReadFile(ff.filePath)
if err != nil {
return nil, err
}
Expand All @@ -120,7 +121,7 @@ func (hf *jsonHTTPFetcher) fetch() ([]entity.Flag, error) {
}
defer res.Body.Close()

b, err := ioutil.ReadAll(res.Body)
b, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/handler/eval_cache_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package handler

import (
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/openflagr/flagr/pkg/config"
Expand All @@ -30,7 +30,7 @@ func TestJSONFileFetcher(t *testing.T) {
func TestJSONHTTPFetcher(t *testing.T) {
t.Run("happy code path", func(t *testing.T) {
h := func(w http.ResponseWriter, r *http.Request) {
b, _ := ioutil.ReadFile("./testdata/sample_eval_cache.json")
b, _ := os.ReadFile("./testdata/sample_eval_cache.json")
io.WriteString(w, string(b))
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/handler/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path"
Expand Down Expand Up @@ -51,11 +50,11 @@ var exportSQLiteFile = func(excludeSnapshots *bool) (file io.ReadCloser, done fu
return nil, done, err
}

content, err := ioutil.ReadFile(fname)
content, err := os.ReadFile(fname)
if err != nil {
return nil, done, err
}
file = ioutil.NopCloser(bytes.NewReader(content))
file = io.NopCloser(bytes.NewReader(content))
return file, done, nil
}

Expand Down

0 comments on commit e398efe

Please sign in to comment.