Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Commit 9b69b2e

Browse files
committed
Remove ioutil
1 parent 6bf18a8 commit 9b69b2e

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

components/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package components
33
import (
44
"fmt"
55
"html/template"
6-
"io/ioutil"
76
"math"
87
"os"
98
"path/filepath"
@@ -20,10 +19,10 @@ func preParseHTML(html string) string {
2019
}
2120

2221
func (theme Theme) parseComponent(component string) string {
23-
comp, err := ioutil.ReadFile(filepath.Join(theme.ThemeDir, "components", component+".html"))
22+
comp, err := os.ReadFile(filepath.Join(theme.ThemeDir, "components", component+".html"))
2423

2524
if os.IsNotExist(err) {
26-
baseComp, err := ioutil.ReadFile(filepath.Join(theme.BaseCss, "components", component+".html"))
25+
baseComp, err := os.ReadFile(filepath.Join(theme.BaseCss, "components", component+".html"))
2726
tools.PanicIfErr(err)
2827
comp = baseComp
2928
} else {

config/autoLinux.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package config
44

55
import (
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"strings"
@@ -50,7 +49,7 @@ func (mask *HeadersMask) Auto() {
5049
winMgr += ","
5150
}
5251

53-
osInfo, err := ioutil.ReadFile("/etc/os-release")
52+
osInfo, err := os.ReadFile("/etc/os-release")
5453
tools.PanicIfErr(err)
5554
distro := ""
5655

fetcher/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"net/http"
98
"os"
109
"path/filepath"
@@ -209,7 +208,7 @@ func (conf ConfigType) FetchMain() {
209208
tools.PanicIfErr(err)
210209
}
211210

212-
assetsBase, err := ioutil.ReadDir(filepath.Join(theme.BaseCss, "assets"))
211+
assetsBase, err := os.ReadDir(filepath.Join(theme.BaseCss, "assets"))
213212

214213
if os.IsNotExist(err) {
215214
} else {
@@ -222,7 +221,7 @@ func (conf ConfigType) FetchMain() {
222221
tools.PanicIfErr(err)
223222
}
224223

225-
assetsTheme, err := ioutil.ReadDir(filepath.Join(theme.ThemeDir, "assets"))
224+
assetsTheme, err := os.ReadDir(filepath.Join(theme.ThemeDir, "assets"))
226225

227226
if os.IsNotExist(err) {
228227
} else {

fetcher/tools.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"net/http"
109
"net/http/cookiejar"
1110
"os"
@@ -42,7 +41,7 @@ func DownloadMedia(mediaDir string, urlToFetch string, name string) {
4241
file, err := os.Create(filepath.Join(mediaDir, name)) // Will overwrite it no matter what, so embed image duplicates are fine :)
4342
tools.PanicIfErr(err)
4443

45-
dwMedia, err := ioutil.ReadAll(resp.Body)
44+
dwMedia, err := io.ReadAll(resp.Body)
4645
tools.PanicIfErr(err)
4746

4847
defer file.Close()
@@ -93,7 +92,7 @@ func (conf ConfigType) discordRequest(method string, uri string, body io.Reader,
9392

9493
res, err := client.Do(req)
9594
tools.PanicIfErr(err)
96-
resBody, err := ioutil.ReadAll(res.Body)
95+
resBody, err := io.ReadAll(res.Body)
9796
tools.PanicIfErr(err)
9897

9998
if res.StatusCode != 200 {

0 commit comments

Comments
 (0)