1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-04 17:43:50 +00:00

Replace deprecated ioutil

As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.
This commit is contained in:
albertony
2022-08-20 16:38:02 +02:00
committed by Nick Craig-Wood
parent 776e5ea83a
commit 5d6b8141ec
108 changed files with 295 additions and 359 deletions

View File

@@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
@@ -64,7 +63,7 @@ func CheckAndDownloadWebGUIRelease(checkUpdate bool, forceUpdate bool, fetchURL
if err != nil {
return fmt.Errorf("error checking for web gui release update, skipping update: %w", err)
}
dat, err := ioutil.ReadFile(tagPath)
dat, err := os.ReadFile(tagPath)
tagsMatch := false
if err != nil {
fs.Errorf(nil, "Error reading tag file at %s ", tagPath)
@@ -129,7 +128,7 @@ func CheckAndDownloadWebGUIRelease(checkUpdate bool, forceUpdate bool, fetchURL
fs.Logf(nil, "Downloaded ZIP cannot be deleted")
}
err = ioutil.WriteFile(tagPath, []byte(tag), 0644)
err = os.WriteFile(tagPath, []byte(tag), 0644)
if err != nil {
fs.Infof(nil, "Cannot write tag file. You may be required to redownload the binary next time.")
}