#Accessing local directories - .Host() method missing on Client?

1 messages · Page 1 of 1 (latest)

fresh cypress
#

I'm struggling a bit with directories. Rather than having to pass a *dagger.Directory in as an arg to my function i'd like to hardcode the path. From looking at the go SDK docs it appears the way to do this would be using dagger.Client.Host().Directory("some-local-poath") however in 0.15.1 the Host() method doesnt appear to exist on the dag global?

I may be holding it wrong but am a bit confused right now. What would be the correct way to hardcode a directory. What i'd like to do in code is:

func (m *CI) BuildMyAwesomeComponent() *dagger.Container {
    return m.GolangBuildContainer().
        WithDirectory("/work", dag.Host().Directory("/path/to/checked/out/repo/root"))
}
pale walrus
#

that particular section of the docs is not super clear but look at the examples, it's actually quite simple

#

you just need to keep the path rooted to the module's git repo, for safety and reusability

fresh cypress
#

Ah great thanks, that makes sense. I had a tingly feeling that was a safety design decision. Added default path comment and works exactly how i'd hoped. Love that it's relative to the repo root of the git checkout! Thanks again.