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) } }