Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 6d05d65

Browse files
Remove usage of deprecated ioutil package
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
1 parent fe2f18b commit 6d05d65

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

pkg/event/read.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package event
77

88
import (
99
"io"
10-
"io/ioutil"
1110
"net/http"
1211
"net/url"
1312
"os"
@@ -86,7 +85,7 @@ func readFile(pathName string) ([]Event, error) {
8685
}
8786

8887
func readDir(pathName string, recursive bool) ([]Event, error) {
89-
list, err := ioutil.ReadDir(pathName)
88+
list, err := os.ReadDir(pathName)
9089
if err != nil {
9190
return nil, err
9291
}

pkg/http/http.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"bytes"
1010
"encoding/json"
1111
"fmt"
12-
"io/ioutil"
12+
"io"
1313
"net/http"
1414
"strings"
1515

@@ -140,7 +140,7 @@ func structuredRequestToEvent(req *http.Request) (*event.Event, error) {
140140
Mode: event.StructuredMode,
141141
}
142142

143-
body, err := ioutil.ReadAll(req.Body)
143+
body, err := io.ReadAll(req.Body)
144144
if err != nil {
145145
return nil, err
146146
}
@@ -202,7 +202,7 @@ func structuredRequestToEvent(req *http.Request) (*event.Event, error) {
202202
}
203203

204204
func binaryRequestToEvent(req *http.Request) (*event.Event, error) {
205-
body, err := ioutil.ReadAll(req.Body)
205+
body, err := io.ReadAll(req.Body)
206206
if err != nil {
207207
return nil, err
208208
}

pkg/http/http_yaml_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package http
77

88
import (
9-
"io/ioutil"
109
"log"
1110
"net/http"
1211
"net/http/httptest"
@@ -29,7 +28,7 @@ Data: |
2928
`
3029

3130
func makeUnitTestYaml() (string, func()) {
32-
file, err := ioutil.TempFile("", "unit_test_*.yaml")
31+
file, err := os.CreateTemp("", "unit_test_*.yaml")
3332
if err != nil {
3433
log.Fatal(err)
3534
}

test/diff_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"context"
1010
"errors"
1111
"fmt"
12-
"io/ioutil"
12+
"io"
1313
"log"
1414
"net/http"
1515
"net/url"
@@ -136,7 +136,7 @@ func curl(target string) ([]byte, error) {
136136
return nil, err
137137
}
138138
defer resp.Body.Close()
139-
body, err := ioutil.ReadAll(resp.Body)
139+
body, err := io.ReadAll(resp.Body)
140140
if err != nil {
141141
return nil, err
142142
}

0 commit comments

Comments
 (0)