mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
Replace uses of ioutil
ioutil package was deprecated in Go 1.16, replace all uses with their respective replacements. This patch was generated with a combination of `gofmt -r`, `eg`, and manually (for `ioutil.ReadDir`).
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -50,7 +49,7 @@ func main() {
|
||||
totals.Add(p)
|
||||
|
||||
fname := strings.Join(strings.Split(p.FileName, "/")[*strip:], "/")
|
||||
src, err := ioutil.ReadFile(fname)
|
||||
src, err := os.ReadFile(fname)
|
||||
if err != nil {
|
||||
errorf("Failed to read %q: %v", fname, err)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"crypto/x509"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
@@ -70,13 +70,13 @@ func main() {
|
||||
fatalf("error getting %q: %v\n", url, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
rbody, err := ioutil.ReadAll(resp.Body)
|
||||
rbody, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
errorf("error reading body: %v\n", err)
|
||||
}
|
||||
|
||||
if *save != "" {
|
||||
err = ioutil.WriteFile(*save, rbody, 0664)
|
||||
err = os.WriteFile(*save, rbody, 0664)
|
||||
if err != nil {
|
||||
errorf("error writing body to file %q: %v\n", *save, err)
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func mkTransport(caCert string) http.RoundTripper {
|
||||
return nil
|
||||
}
|
||||
|
||||
certs, err := ioutil.ReadFile(caCert)
|
||||
certs, err := os.ReadFile(caCert)
|
||||
if err != nil {
|
||||
fatalf("error reading CA file %q: %v\n", caCert, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user