use fs facilities
The ioutil module was deprecated some years ago, so use the newer version of the same tools.
This commit is contained in:
parent
b06f25281f
commit
6f3e8d4772
@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"log/slog"
|
||||
"net"
|
||||
@ -139,18 +138,15 @@ func main() {
|
||||
|
||||
tmpl := template.New("main")
|
||||
tmpl.Funcs(Funcs)
|
||||
files, err := ioutil.ReadDir(config.TemplatePath)
|
||||
files, err := os.ReadDir(config.TemplatePath)
|
||||
if err != nil {
|
||||
log.Fatalf("could not read directory '%s': %s", config.TemplatePath, err)
|
||||
}
|
||||
for _, file := range files {
|
||||
if !file.Mode().IsRegular() {
|
||||
continue
|
||||
}
|
||||
if !strings.HasSuffix(file.Name(), ".html") {
|
||||
continue
|
||||
}
|
||||
raw, err := ioutil.ReadFile(path.Join(config.TemplatePath, file.Name()))
|
||||
raw, err := os.ReadFile(path.Join(config.TemplatePath, file.Name()))
|
||||
if err != nil {
|
||||
log.Fatalf("could not read file '%s': %s", path.Join(config.TemplatePath, file.Name()), err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user