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: backend_kqueue.go
    path of file: ./repos/streamdal/apps/server/vendor/github.com/fsnotify/fsnotify
    
    the code of the file until where you have to start completion: //go:build freebsd || openbsd || netbsd || dragonfly || darwin
// +build freebsd openbsd netbsd dragonfly darwin

package fsnotify

import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"sync"

	"golang.org/x/sys/unix"
)

// Watcher watches a set of paths, delivering events on a channel.
//
// A watcher should not be copied (e.g. pass it by pointer, rather 
    
func (w *Watcher) sendDirectoryChangeEvents(dir string) {
	// Get all files
	files, err := ioutil.ReadDir(dir)
	if err != nil {
		if !w.sendError(fmt.Errorf("fsnotify.sendDirectoryChangeEvents: %w", err)) {
			return
		}
	}

	// Search for new files
	for _, fi := range files {
		err := w.sendFileCreatedEventIfNew(filepath.Join(dir, fi.Name()), fi)
		if err != nil {
			return
		}
	}
}