Skip to content

Commit

Permalink
all: update go directive to 1.18 [generated]
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dmitshur authored and gopherbot committed Nov 7, 2023
1 parent 8125cd0 commit 2a66dfb
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module golang.org/dl

go 1.11
go 1.18
8 changes: 3 additions & 5 deletions internal/genv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.

//go:build go1.13
// +build go1.13

// The genv command generates version-specific go command source files.
package main
Expand All @@ -14,7 +13,6 @@ import (
"errors"
"fmt"
"html/template"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -60,8 +58,8 @@ func main() {
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
failf("%v", err)
}
if err := ioutil.WriteFile(path, buf.Bytes(), 0666); err != nil {
failf("ioutil.WriteFile: %v", err)
if err := os.WriteFile(path, buf.Bytes(), 0666); err != nil {
failf("os.WriteFile: %v", err)
}
fmt.Println("Wrote", path)
if err := exec.Command("gofmt", "-w", path).Run(); err != nil {
Expand Down Expand Up @@ -89,7 +87,7 @@ func versionNoPatch(ver string) string {
return m[1]
}

func failf(format string, args ...interface{}) {
func failf(format string, args ...any) {
if len(format) == 0 || format[len(format)-1] != '\n' {
format += "\n"
}
Expand Down
1 change: 0 additions & 1 deletion internal/genv/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.

//go:build go1.13
// +build go1.13

package main

Expand Down
1 change: 0 additions & 1 deletion internal/version/signal_notunix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.

//go:build plan9 || windows
// +build plan9 windows

package version

Expand Down
1 change: 0 additions & 1 deletion internal/version/signal_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.

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

package version

Expand Down
5 changes: 2 additions & 3 deletions internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -149,7 +148,7 @@ func install(targetDir, version string) error {
if err := unpackArchive(targetDir, archiveFile); err != nil {
return fmt.Errorf("extracting archive %v: %v", archiveFile, err)
}
if err := ioutil.WriteFile(filepath.Join(targetDir, unpackedOkay), nil, 0644); err != nil {
if err := os.WriteFile(filepath.Join(targetDir, unpackedOkay), nil, 0644); err != nil {
return err
}
log.Printf("Success. You may now run '%v'", version)
Expand Down Expand Up @@ -320,7 +319,7 @@ func slurpURLToString(url_ string) (string, error) {
if res.StatusCode != http.StatusOK {
return "", fmt.Errorf("%s: %v", url_, res.Status)
}
slurp, err := ioutil.ReadAll(res.Body)
slurp, err := io.ReadAll(res.Body)
if err != nil {
return "", fmt.Errorf("reading %s: %v", url_, err)
}
Expand Down

0 comments on commit 2a66dfb

Please sign in to comment.