commit 702eecdf6b41a6e9b2109dea62d3582f28b1c093
parent 092dba3542deb26686332168d92a6f347df5b088
Author: gearsix <gearsix@tuta.io>
Date: Thu, 16 Mar 2023 16:01:19 +0000
template.go: typo fixes, should've run tests
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/template.go b/template.go
@@ -137,14 +137,14 @@ func (t *Template) Execute(data interface{}) (result bytes.Buffer, err error) {
// ExecuteToFile writes the result of `(*Template).Execute(data)` to the file at `path` (if no errors occurred).
// If `force` is true, any existing file at `path` will be overwritten.
-func (t *Template)ExecuteToFile(data interface{}, path string, force bool) (file *os.File, err error) {
+func (t *Template)ExecuteToFile(data interface{}, path string, force bool) (f *os.File, err error) {
if f, err := os.Open(path); os.IsNotExist(err) {
f, err = os.Create(path)
} else if !force {
err = os.ErrExist
} else { // overwrite existing file data
- if err = f.Truncase(0); err == nil {
- _, err = f.Seek(0, 0)i
+ if err = f.Truncate(0); err == nil {
+ _, err = f.Seek(0, 0)
}
}