beegoinit-cmd/utils/utils.go

22 lines
305 B
Go
Raw Normal View History

2020-08-31 14:37:22 +08:00
package utils
import "os"
func WriteToFile(filename, content string) {
f, err := os.Create(filename)
defer CloseFile(f)
_, err = f.WriteString(content)
MustCheck(err)
}
func CloseFile(f *os.File) {
err := f.Close()
MustCheck(err)
}
func MustCheck(err error) {
if err != nil {
panic(err)
}
}