all: clean up obsolete +build lines and io/ioutil uses [generated]
The module go directive is at 1.20, so modernize it a bit by
applying changes generated by the script below with go1.21.1.
[git-generate]
go fix ./...
gofmt -r 'ioutil.Discard -> io.Discard' -w .
gofmt -r 'ioutil.NopCloser -> io.NopCloser' -w .
gofmt -r 'ioutil.ReadAll -> io.ReadAll' -w .
gofmt -r '"ioutil.ReadAll: %v" -> "io.ReadAll: %v"' -w .
gofmt -r 'ioutil.ReadDir -> os.ReadDir' -w .
gofmt -r 'ioutil.ReadFile -> os.ReadFile' -w .
gofmt -r 'ioutil.TempDir -> os.MkdirTemp' -w .
gofmt -r 'ioutil.TempFile -> os.CreateTemp' -w .
gofmt -r 'ioutil.WriteFile -> os.WriteFile' -w .
goimports -w .
Change-Id: I145b27756e7c6101e992747ee822e7237df4cb91
Reviewed-on: https://go-review.googlesource.com/c/build/+/527016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/gerrit/auth.go b/gerrit/auth.go
index 7afad05..16bc97f 100644
--- a/gerrit/auth.go
+++ b/gerrit/auth.go
@@ -9,7 +9,6 @@
"crypto/md5"
"encoding/hex"
"fmt"
- "io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
@@ -102,7 +101,7 @@
// got so long that old versions of curl couldn't handle them.
host := url.Host
netrc := netrcPath()
- data, _ := ioutil.ReadFile(netrc)
+ data, _ := os.ReadFile(netrc)
for _, line := range strings.Split(string(data), "\n") {
if i := strings.Index(line, "#"); i >= 0 {
line = line[:i]
@@ -125,7 +124,7 @@
}
func (a *gitCookieFileAuth) loadCookieFileOnce() {
- data, err := ioutil.ReadFile(a.file)
+ data, err := os.ReadFile(a.file)
if err != nil {
a.err = fmt.Errorf("Error loading cookie file: %v", err)
return