diff --git a/api.go b/api.go index 864256c..59f4ecb 100644 --- a/api.go +++ b/api.go @@ -3,7 +3,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/julienschmidt/httprouter" @@ -24,7 +24,7 @@ func webRegisterPost(w http.ResponseWriter, r *http.Request, _ httprouter.Params var reg []byte var err error aTXT := ACMETxt{} - bdata, _ := ioutil.ReadAll(r.Body) + bdata, _ := io.ReadAll(r.Body) if len(bdata) > 0 { err = json.Unmarshal(bdata, &aTXT) if err != nil { diff --git a/main_test.go b/main_test.go index 66f4d6e..c223e25 100644 --- a/main_test.go +++ b/main_test.go @@ -3,12 +3,13 @@ package main import ( "flag" "fmt" - log "github.com/sirupsen/logrus" - logrustest "github.com/sirupsen/logrus/hooks/test" - "io/ioutil" + "io" "os" "sync" "testing" + + log "github.com/sirupsen/logrus" + logrustest "github.com/sirupsen/logrus/hooks/test" ) var loghook = new(logrustest.Hook) @@ -96,7 +97,7 @@ func setupConfig() { } func setupTestLogger() { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) log.AddHook(loghook) } diff --git a/util_test.go b/util_test.go index 1eb4b67..7be43e3 100644 --- a/util_test.go +++ b/util_test.go @@ -1,7 +1,6 @@ package main import ( - "io/ioutil" "os" "syscall" "testing" @@ -51,7 +50,7 @@ func TestReadConfig(t *testing.T) { DNSConfig{}, }, } { - tmpfile, err := ioutil.TempFile("", "acmedns") + tmpfile, err := os.CreateTemp("", "acmedns") if err != nil { t.Error("Could not create temporary file") } @@ -99,7 +98,7 @@ func TestGetIPListFromHeader(t *testing.T) { } func TestFileCheckPermissionDenied(t *testing.T) { - tmpfile, err := ioutil.TempFile("", "acmedns") + tmpfile, err := os.CreateTemp("", "acmedns") if err != nil { t.Error("Could not create temporary file") } @@ -118,7 +117,7 @@ func TestFileCheckNotExists(t *testing.T) { } func TestFileCheckOK(t *testing.T) { - tmpfile, err := ioutil.TempFile("", "acmedns") + tmpfile, err := os.CreateTemp("", "acmedns") if err != nil { t.Error("Could not create temporary file") }