1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

fix: fix errorhandling and folder generation

This commit is contained in:
retgits 2019-01-20 13:00:26 -08:00
parent d219d3e276
commit fa07e36b2e
No known key found for this signature in database
GPG Key ID: 9D3AD75D6182395C

View File

@ -10,6 +10,7 @@
package main package main
import ( import (
"fmt"
"os" "os"
"strings" "strings"
"text/template" "text/template"
@ -40,7 +41,15 @@ func main() {
"Title": strings.Title, "Title": strings.Title,
}).ParseFiles("generator/textwidget.tpl") }).ParseFiles("generator/textwidget.tpl")
out, _ := os.Create("generator/test.go") err := os.Mkdir(strings.ToLower(widgetName), os.ModePerm)
if err != nil {
fmt.Println(err.Error())
}
out, err := os.Create(fmt.Sprintf("%s/widget.go", strings.ToLower(widgetName)))
if err != nil {
fmt.Println(err.Error())
}
defer out.Close() defer out.Close()
tpl.Execute(out, data) tpl.Execute(out, data)