~emersion/hut-dev

Remove deprecated ioutil package v1 APPLIED

Thorben Günther: 1
 Remove deprecated ioutil package

 4 files changed, 7 insertions(+), 10 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/hut-dev/patches/34448/mbox | git am -3
Learn more about email & git

[PATCH] Remove deprecated ioutil package Export this patch

io/ioutil is deprecated and simply contains wrapper functions to "io" or
"os" [1] since Go 1.16. hut uses a minimum version of 1.17.

[1]: https://godocs.io/io/ioutil
---
 git.go   | 4 ++--
 lists.go | 3 +--
 main.go  | 5 ++---
 meta.go  | 5 ++---
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/git.go b/git.go
index 1147663..d8d85a7 100644
--- a/git.go
+++ b/git.go
@@ -3,7 +3,7 @@ package main
import (
	"context"
	"fmt"
	"io/ioutil"
	"io"
	"log"
	"net/url"
	"os"
@@ -706,7 +706,7 @@ func newGitUpdateCommand() *cobra.Command {
			)

			if readme == "-" {
				b, err = ioutil.ReadAll(os.Stdin)
				b, err = io.ReadAll(os.Stdin)
			} else {
				b, err = os.ReadFile(readme)
			}
diff --git a/lists.go b/lists.go
index 6b0c69d..7453bf3 100644
--- a/lists.go
+++ b/lists.go
@@ -6,7 +6,6 @@ import (
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/mail"
	"os"
@@ -213,7 +212,7 @@ func newListsCreateCommand() *cobra.Command {
		var description *string

		if stdin {
			b, err := ioutil.ReadAll(os.Stdin)
			b, err := io.ReadAll(os.Stdin)
			if err != nil {
				log.Fatalf("failed to read mailing list description: %v", err)
			}
diff --git a/main.go b/main.go
index 5156552..c4fc20f 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,6 @@ import (
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
@@ -148,7 +147,7 @@ func getInputWithEditor(pattern, initialText string) (string, error) {
		return "", errors.New("EDITOR not set")
	}

	file, err := ioutil.TempFile("", pattern)
	file, err := os.CreateTemp("", pattern)
	if err != nil {
		return "", err
	}
@@ -176,7 +175,7 @@ func getInputWithEditor(pattern, initialText string) (string, error) {
		return "", err
	}

	content, err := ioutil.ReadFile(file.Name())
	content, err := os.ReadFile(file.Name())
	if err != nil {
		return "", err
	}
diff --git a/meta.go b/meta.go
index ee9d50e..96f7c1d 100644
--- a/meta.go
+++ b/meta.go
@@ -4,7 +4,6 @@ import (
	"context"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
@@ -133,7 +132,7 @@ func newMetaSSHKeyCreateCommand() *cobra.Command {
			}
		}

		b, err := ioutil.ReadFile(filename)
		b, err := os.ReadFile(filename)
		if err != nil {
			log.Fatal(err)
		}
@@ -295,7 +294,7 @@ func newMetaPGPKeyCreateCommand() *cobra.Command {
			err      error
		)
		if len(args) > 0 {
			keyBytes, err = ioutil.ReadFile(args[0])
			keyBytes, err = os.ReadFile(args[0])
		} else {
			keyBytes, err = exportDefaultPGPKey(ctx)
		}

base-commit: 721092e97a7bcf33dd472b87d12ac71246c48c2e
-- 
2.37.1
Pushed, thanks!