all: Replace deprecated ioutil with io and os

This commit is contained in:
Oleksandr Redko 2023-05-23 17:55:26 +03:00 committed by Bjørn Erik Pedersen
parent 8c7a4e995b
commit 4c46f9400b
3 changed files with 4 additions and 6 deletions

View file

@ -20,7 +20,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
@ -848,7 +847,7 @@ func (c *serverCommand) serve() error {
if err != nil { if err != nil {
return err return err
} }
err = ioutil.WriteFile(readyFile, b, 0777) err = os.WriteFile(readyFile, b, 0777)
if err != nil { if err != nil {
return err return err
} }

View file

@ -17,8 +17,8 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"io/fs" "io/fs"
"io/ioutil"
"log" "log"
"net/http" "net/http"
"os" "os"
@ -203,7 +203,7 @@ var commonTestScriptsParam = testscript.Params{
} }
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return fmt.Errorf("failed to read response body: %v", err) return fmt.Errorf("failed to read response body: %v", err)
} }

View file

@ -23,7 +23,6 @@ import (
"go/doc" "go/doc"
"go/parser" "go/parser"
"go/token" "go/token"
"io/ioutil"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
@ -276,7 +275,7 @@ func getGetTplPackagesGoDoc() map[string]map[string]methodGoDocInfo {
basePath = filepath.Join(pwd, "tpl") basePath = filepath.Join(pwd, "tpl")
} }
files, err := ioutil.ReadDir(basePath) files, err := os.ReadDir(basePath)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }