Skip to content

Commit 2a66dfb

Browse files
dmitshurgopherbot
authored andcommitted
all: update go directive to 1.18 [generated]
Update the go directive to 1.18, and modernize the module by applying changes generated by the script below with go1.21.4. For golang/go#60268. [git-generate] go get [email protected] go mod tidy go fix ./... gofmt -r 'ioutil.ReadAll -> io.ReadAll' -w . gofmt -r 'ioutil.WriteFile -> os.WriteFile' -w . gofmt -r '"ioutil.WriteFile: %v" -> "os.WriteFile: %v"' -w . gofmt -r 'interface{} -> any' -w . goimports -w . Change-Id: I34a020389eb7f5b90f93da12595604c4a0134eae Reviewed-on: https://go-review.googlesource.com/c/dl/+/540221 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 8125cd0 commit 2a66dfb

File tree

6 files changed

+6
-12
lines changed

6 files changed

+6
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module golang.org/dl
22

3-
go 1.11
3+
go 1.18

internal/genv/main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build go1.13
6-
// +build go1.13
76

87
// The genv command generates version-specific go command source files.
98
package main
@@ -14,7 +13,6 @@ import (
1413
"errors"
1514
"fmt"
1615
"html/template"
17-
"io/ioutil"
1816
"os"
1917
"os/exec"
2018
"path/filepath"
@@ -60,8 +58,8 @@ func main() {
6058
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
6159
failf("%v", err)
6260
}
63-
if err := ioutil.WriteFile(path, buf.Bytes(), 0666); err != nil {
64-
failf("ioutil.WriteFile: %v", err)
61+
if err := os.WriteFile(path, buf.Bytes(), 0666); err != nil {
62+
failf("os.WriteFile: %v", err)
6563
}
6664
fmt.Println("Wrote", path)
6765
if err := exec.Command("gofmt", "-w", path).Run(); err != nil {
@@ -89,7 +87,7 @@ func versionNoPatch(ver string) string {
8987
return m[1]
9088
}
9189

92-
func failf(format string, args ...interface{}) {
90+
func failf(format string, args ...any) {
9391
if len(format) == 0 || format[len(format)-1] != '\n' {
9492
format += "\n"
9593
}

internal/genv/main_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build go1.13
6-
// +build go1.13
76

87
package main
98

internal/version/signal_notunix.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build plan9 || windows
6-
// +build plan9 windows
76

87
package version
98

internal/version/signal_unix.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build aix || darwin || dragonfly || freebsd || js || linux || netbsd || openbsd || solaris || wasip1
6-
// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris wasip1
76

87
package version
98

internal/version/version.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"errors"
1414
"fmt"
1515
"io"
16-
"io/ioutil"
1716
"log"
1817
"net/http"
1918
"os"
@@ -149,7 +148,7 @@ func install(targetDir, version string) error {
149148
if err := unpackArchive(targetDir, archiveFile); err != nil {
150149
return fmt.Errorf("extracting archive %v: %v", archiveFile, err)
151150
}
152-
if err := ioutil.WriteFile(filepath.Join(targetDir, unpackedOkay), nil, 0644); err != nil {
151+
if err := os.WriteFile(filepath.Join(targetDir, unpackedOkay), nil, 0644); err != nil {
153152
return err
154153
}
155154
log.Printf("Success. You may now run '%v'", version)
@@ -320,7 +319,7 @@ func slurpURLToString(url_ string) (string, error) {
320319
if res.StatusCode != http.StatusOK {
321320
return "", fmt.Errorf("%s: %v", url_, res.Status)
322321
}
323-
slurp, err := ioutil.ReadAll(res.Body)
322+
slurp, err := io.ReadAll(res.Body)
324323
if err != nil {
325324
return "", fmt.Errorf("reading %s: %v", url_, err)
326325
}

0 commit comments

Comments
 (0)