Skip to content

Commit 6a932bb

Browse files
committed
scan: replace uses of deprecated io/ioutil
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 5b8919c commit 6a932bb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

scan/crypto/md5/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build ignore
56
// +build ignore
67

78
// This program generates md5block.go
@@ -18,7 +19,6 @@ import (
1819
"bytes"
1920
"flag"
2021
"go/format"
21-
"io/ioutil"
2222
"log"
2323
"strings"
2424
"text/template"
@@ -40,7 +40,7 @@ func main() {
4040
if err != nil {
4141
log.Fatal(err)
4242
}
43-
err = ioutil.WriteFile(*filename, data, 0644)
43+
err = os.WriteFile(*filename, data, 0644)
4444
if err != nil {
4545
log.Fatal(err)
4646
}

scan/crypto/tls/handshake_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"flag"
1212
"fmt"
1313
"io"
14-
"io/ioutil"
1514
"net"
15+
"os"
1616
"strconv"
1717
"strings"
1818
"sync"
@@ -156,7 +156,7 @@ func parseTestData(r io.Reader) (flows [][]byte, err error) {
156156

157157
// tempFile creates a temp file containing contents and returns its path.
158158
func tempFile(contents string) string {
159-
file, err := ioutil.TempFile("", "go-tls-test")
159+
file, err := os.CreateTemp("", "go-tls-test")
160160
if err != nil {
161161
panic("failed to create temp file: " + err.Error())
162162
}

scan/crypto/tls/tls.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"encoding/pem"
1919
"errors"
2020
"fmt"
21-
"io/ioutil"
2221
"net"
22+
"os"
2323
"strings"
2424
"time"
2525
)
@@ -176,11 +176,11 @@ func Dial(network, addr string, config *Config) (*Conn, error) {
176176
// Certificate.Leaf will be nil because the parsed form of the certificate is
177177
// not retained.
178178
func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) {
179-
certPEMBlock, err := ioutil.ReadFile(certFile)
179+
certPEMBlock, err := os.ReadFile(certFile)
180180
if err != nil {
181181
return Certificate{}, err
182182
}
183-
keyPEMBlock, err := ioutil.ReadFile(keyFile)
183+
keyPEMBlock, err := os.ReadFile(keyFile)
184184
if err != nil {
185185
return Certificate{}, err
186186
}

0 commit comments

Comments
 (0)