i have a constructor that take a directory, i tried to add the ignore comment but it seems to be ignore. Here you can repoduce with this i think
package main
import (
"context"
"fmt"
"dagger.io/dagger":*
)
func New(
// ignore only *.ignore files
// +ignore=["**/*.ignore"]
dir *dagger.Directory,
) *MyModule {
return &MyModule{
Dir: dir,
}
}
type MyModule struct {
Dir *dagger.Directory
}
// Count remaining files after ignore rules are applied
func (m *MyModule) FileCount(ctx context.Context) (int, error) {
files, err := m.Dir.Entries(ctx)
if err != nil {
return 0, err
}
return len(files), nil
}
// Another function taking a second directory, also ignoring *.ignore
func (m *MyModule) CompareCounts(
ctx context.Context,
// +ignore=["**/*.ignore"]
other *dagger.Directory,
) (string, error) {
mainCount, err := m.FileCount(ctx)
if err != nil {
return "", err
}
otherFiles, err := other.Entries(ctx)
if err != nil {
return "", err
}
return fmt.Sprintf(
"Module directory: %d files, provided directory: %d files",
mainCount, len(otherFiles),
), nil
}