checks if the file actualy exist or not
fileInfo, err := os.Stat("test.txt") if os.IsNotExist(err) { log.Fatal("File does not exist.") } log.Println("File does exist. File information:", fileInfo)