Bruno has a file called songs.txt with all his favorite songs. He wants to open the file in his Go program to read the data from it and then print it to the console.
Bruno has already written the required code to print the file contents to the console; however, he forgot how to properly open the file! Please help Bruno write the additional required code to open songs.txt and store it within the file variable. Remember to implement error handling within the if statement.
This problem uses the
bufio package to scan the text contained within songs.txt. To solve this task, you don't need to know how the bufio package works. The only objective is to open songs.txt and implement error handling within the if statement.