Skip to content

Commit

Permalink
Fix io/ioutil deprecation warnings (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Apr 17, 2023
1 parent 0f4f2a6 commit 5ac8043
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions http.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"io/ioutil"
"io"
"log"
"net/http"
"os"
"regexp"
)

Expand All @@ -14,7 +15,7 @@ func httpIndex(w http.ResponseWriter, r *http.Request) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return
}
data, _ := ioutil.ReadFile(wwwRoot + "/index.html")
data, _ := os.ReadFile(wwwRoot + "/index.html")

w.Write(data)
}
Expand All @@ -37,7 +38,7 @@ func httpLogs(w http.ResponseWriter, r *http.Request) {
}
defer response.Body.Close()

data, err := ioutil.ReadAll(response.Body)
data, err := io.ReadAll(response.Body)
if err != nil {
log.Printf("Issue with fetch the logs: %s", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
Expand Down

0 comments on commit 5ac8043

Please sign in to comment.