Error when opening a file

Report a typo

Write the required additional code to print the following error when trying to open a non-existing file called nonexisting_file.txt:

open nonexisting_file.txt: no such file or directory

Take notice that to solve this task, you must not modify, delete or write any other code within the main function. Your only objective is to add error handling within the checkFile function and print the error contained within the err variable.
Write a program in Go
package main

import (
"fmt"
"os"
)

func checkFile(filename string) {
file, err := os.Open(filename)
if ? {
fmt.Println(?)
return
}
defer file.Close()
}

// DO NOT delete or modify the contents of the main function!
func main() {
checkFile("nonexisting_file.txt")
}
___

Create a free account to access the full topic