You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: does_have_write_perm.go
    path of file: ./repos/Cookbook/go/files
    
    the code of the file until where you have to start completion: package main

import (
	"log"
	"os"
)

func main() {
	// Test write permissions. It is possible the file
	// does not exist and that will return a different
	// error that can be checked with os.IsNotExist(err)
	file, err := os.OpenFile("test.txt", os.O_WRONLY, 0666)
	if err != nil {
		if os.IsPermission(err) {
			log.Println(
    
func main() {
	// Test write permissions. It is possible the file
	// does not exist and that will return a different
	// error that can be checked with os.IsNotExist(err)
	file, err := os.OpenFile("test.txt", os.O_WRONLY, 0666)
	if err != nil {
		if os.IsPermission(err) {
			log.Println("Error: Write permission denied.")
		}
	}
	file.Close()

	// Test read permissions
	file, err = os.OpenFile("test.txt", os.O_RDONLY, 0666)
	if err != nil {
		if os.IsPermission(err) {
			log.Println("Error: Read permission denied.")
		}
	}
	file.Close()
}