tss/exp/file/file.go

30 lines
454 B
Go
Raw Normal View History

2022-04-28 19:24:21 -04:00
package main
import (
"fmt"
"log"
"os"
)
func main() {
fmt.Println("vim-go")
f, err := os.Create("./lsdkj/lfksdjf")
if err != nil {
log.Panicln(err)
}
err = f.Close()
if err != nil {
log.Panicln(err)
}
log.Println("created")
/*
data, err := os.ReadFile("./foo/notexist")
if err == nil {
fmt.Println(data)
} else if errors.Is(err, os.ErrNotExist) {
fmt.Printf("not exist: %v\n", err)
}
fmt.Printf("err: %v\n", err)
*/
}