fixed nil

This commit is contained in:
bobbert committed 2026-07-15 20:39:23 +01:00
1 parent b2512bd39a
commit 16d9c8b171
1 file changed
+9 -1
+9 -1
View File
@@ -7,9 +7,16 @@ import (
"path/filepath"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func write(a, b string) {
path := filepath.Join(a, b)
file, _ := os.Create(path)
file, err := os.Create(path)
check(err)
file.Sync()
@@ -23,4 +30,5 @@ func main() {
fmt.Println("Leanring go.")
fmt.Println("Adding a function to create a file")
write("./", "file.txt")
fmt.Println("File created successfully. with contents inside")
}