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: filter.go
    path of file: ./repos/sealer/vendor/github.com/ipfs/go-ipfs-files
    
    the code of the file until where you have to start completion: package files

import (
	"os"

	ignore "github.com/crackcomm/go-gitignore"
)

// Filter represents a set of rules for determining if a file should be included or excluded.
// A rule follows the syntax for patterns used in .gitgno
    
func NewFilter(ignoreFile string, rules []string, includeHidden bool) (*Filter, error) {
	var ignoreRules *ignore.GitIgnore
	var err error
	if ignoreFile == "" {
		ignoreRules, err = ignore.CompileIgnoreLines(rules...)
	} else {
		ignoreRules, err = ignore.CompileIgnoreFileAndLines(ignoreFile, rules...)
	}
	if err != nil {
		return nil, err
	}
	return &Filter{IncludeHidden: includeHidden, Rules: ignoreRules}, nil
}