diff options
author | Parsa Yousefi <parsa.yousefi@ionos.com> | 2024-09-05 16:05:51 +0200 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2024-09-05 16:05:51 +0200 |
commit | 6f3e8d47722b8bd7fb60e07a2c3ab68394bda4d1 (patch) | |
tree | f44759514efb87e3ae8f2b88b7f9fd76c534774a /cmd | |
parent | b06f25281f22eae33839a349bc3dd26ed403b4c6 (diff) |
use fs facilities
The ioutil module was deprecated some years ago, so use the newer
version of the same tools.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/monfront/main.go | 8 |
1 files 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) } |