rebase 12/02, use go1.16rc1 in make, remove ioutil, start switching to io/fs for file i/o

ioutil's contents are now in io and os.
Eventually jfa-go's files will be embedded in the binary with go1.16's
new embed feature. Using io/fs will provide abstraction for accessing
these files, and allow for both embedded and non-embedded versions.
Also, internal paths to things like email templates, etc. will be
prefixed with "jfa-go:" to indicate to use the app's own Filesystem
instead of reading the file normally. This also allows for custom files
to continue to be used as they are currently.
This commit is contained in:
Harvey Tindall
2021-01-31 23:12:50 +00:00
parent 1af8d1f77d
commit fefe2d82a4
10 changed files with 170 additions and 144 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"encoding/json"
"io/ioutil"
"os"
"strings"
"time"
@@ -53,7 +52,7 @@ func pwrMonitor(app *appContext, watcher *fsnotify.Watcher) {
}
if event.Op&fsnotify.Write == fsnotify.Write && strings.Contains(event.Name, "passwordreset") {
var pwr PasswordReset
data, err := ioutil.ReadFile(event.Name)
data, err := os.ReadFile(event.Name)
if err != nil {
return
}