package main import ( "os" "path/filepath" ignore "github.com/sabhiram/go-gitignore" ) func loadGitignore(hostDir string) (*ignore.GitIgnore, error) { gitignorePath := filepath.Join(hostDir, ".gitignore") data, err := os.ReadFile(gitignorePath) if err != nil { if os.IsNotExist(err) { return ignore.CompileIgnoreLines(), nil } return nil, err } return ignore.CompileIgnoreLines(string(data)), nil }