Skip to content

Commit

Permalink
Updating deprecated io/util (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
boyamurthy authored Sep 4, 2023
1 parent 32621f7 commit 00dd1de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions api/api_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httputil"
"strings"
Expand Down Expand Up @@ -143,7 +142,7 @@ func drainBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error) {
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
}

// dumpRequest returns the given request in its HTTP/1.x wire
Expand Down
4 changes: 2 additions & 2 deletions mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"net/http"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -3270,7 +3270,7 @@ func writeError(w http.ResponseWriter, message string, httpStatus int) {
//
// An optional replacement map. If supplied every instance of a key in the JSON file will be replaced with the corresponding value.
func returnJSONFile(directory, filename string, w http.ResponseWriter, replacements map[string]string) (jsonBytes []byte) {
jsonBytes, err := ioutil.ReadFile(filepath.Join(directory, filename)) // #nosec G20
jsonBytes, err := os.ReadFile(filepath.Join(directory, filename)) // #nosec G20
if err != nil {
log.Printf("Couldn't read %s/%s", directory, filename)
if w != nil {
Expand Down

0 comments on commit 00dd1de

Please sign in to comment.