Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove refs to deprecated io/ioutil #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/crawler/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package crawler

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -66,7 +66,7 @@ func writeFileToPath(projectPath, base, oldFileExt, newFileExt, fileDir string,
panic(err)
}
defer f.Close()
htmlData, err := ioutil.ReadAll(resp.Body)
htmlData, err := io.ReadAll(resp.Body)

if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/crawler/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package crawler

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"crypto/tls"
Expand All @@ -28,7 +28,7 @@ func HTMLExtractor(link string, projectPath string) {
panic(err)
}
defer f.Close()
htmlData, err := ioutil.ReadAll(resp.Body)
htmlData, err := io.ReadAll(resp.Body)

if err != nil {
panic(err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/html/arrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package html
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
Expand All @@ -14,7 +14,7 @@ import (
// TODO: figure out what was done here at 4am
func arrange(projectDir string) error {
indexfile := projectDir + "/index.html"
input, err := ioutil.ReadFile(indexfile)
input, err := os.ReadFile(indexfile)
if err != nil {
return err
}
Expand Down Expand Up @@ -70,7 +70,7 @@ func arrange(projectDir string) error {
})
}
output := strings.Join(lines, "\n")
return ioutil.WriteFile(indexfile, []byte(output), 0777)
return os.WriteFile(indexfile, []byte(output), 0777)
}

var reSrc = regexp.MustCompile(`src\s*=\s*"(.+?)"`)
6 changes: 3 additions & 3 deletions pkg/html/formatter.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package html

import (
"io/ioutil"
"os"

"github.com/yosssi/gohtml"
)

// FormatHTML will formart any given string of HTML
func FormatHTML(filePath string) {
// TODO: Implement
dat, err := ioutil.ReadFile(filePath)
dat, err := os.ReadFile(filePath)
if err != nil {
panic(err)
}
data := gohtml.Format(string(dat))
b := []byte(data)
error := ioutil.WriteFile(filePath, b, 0777)
error := os.WriteFile(filePath, b, 0777)
// handle this error
if error != nil {
// print it out
Expand Down