from what i understand from this doc about code execution
When implementing Dagger Functions, you are free to write arbitrary code that will execute inside the Dagger Module's container.
we can utilize golang to do things inside the container. But what I can't figure out is, how can i mount the folder on my host (for example: code checked out with a gihub action in previous step) to perform actions inside the reposiotry folder.
eg: here I'm trying to load a git repository using pkg "github.com/go-git/go-git/v5"
func (m *CI) Apply(
ctx context.Context,
src *dagger.Directory,
) error{
o := &Options{
Dir: ".",
}
err := o.Run()
if err != nil {
log.Logger().Errorf("failed to run: %v", err)
return err
}
return nil
}
// Options the options for the command
type Options struct {
Dir string
...
}
func (o *Options) Run() error {
if o.repo == nil {
o.repo, err = git.PlainOpen(o.Dir)
if err != nil {
return errors.Wrapf(err, "failed to open git repository")
}
}
}```