Skip to content

Commit

Permalink
Merge pull request #261 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
derailed authored Dec 8, 2023
2 parents 7df5c6e + 20ae272 commit 92c2e3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/report/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package report
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"strings"
"testing"

Expand Down Expand Up @@ -110,7 +110,7 @@ func TestDump(t *testing.T) {
}

func BenchmarkPrint(b *testing.B) {
s := NewSanitizer(ioutil.Discard, false)
s := NewSanitizer(io.Discard, false)

b.ResetTimer()
b.ReportAllocs()
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

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

"github.com/derailed/popeye/internal/client"
"gopkg.in/yaml.v2"
Expand All @@ -22,7 +22,7 @@ func NewConfig(flags *Flags) (*Config, error) {
cfg := Config{Popeye: NewPopeye()}

if isSet(flags.Spinach) {
f, err := ioutil.ReadFile(*flags.Spinach)
f, err := os.ReadFile(*flags.Spinach)
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/popeye.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -444,10 +443,10 @@ func (p *Popeye) dumpStd(mode, header bool) error {
func (p *Popeye) Do(req *http.Request) (*http.Response, error) {
resp := http.Response{
// Avoid panic when the pusher tries to close the body
Body: ioutil.NopCloser(bytes.NewBufferString("Dummy response from file writer")),
Body: io.NopCloser(bytes.NewBufferString("Dummy response from file writer")),
}

out, err := ioutil.ReadAll(req.Body)
out, err := io.ReadAll(req.Body)
if err != nil {
resp.StatusCode = http.StatusInternalServerError
return &resp, err
Expand Down

0 comments on commit 92c2e3c

Please sign in to comment.