From 6f3e8d47722b8bd7fb60e07a2c3ab68394bda4d1 Mon Sep 17 00:00:00 2001 From: Parsa Yousefi Date: Thu, 5 Sep 2024 16:05:51 +0200 Subject: [PATCH] use fs facilities The ioutil module was deprecated some years ago, so use the newer version of the same tools. --- cmd/monfront/main.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index c56dafd..68138fc 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -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) }