MCPcopy Create free account
hub / github.com/dagger/dagger / initDangModule

Function initDangModule

core/integration/workspace_test.go:37–47  ·  view source on GitHub ↗

initDangModule creates a Dang module in the workspace with the given name and source code. Uses "dagger init" and "dagger toolchain install" to scaffold the workspace and module, then overwrites main.dang with the provided source.

(name, source string)

Source from the content-addressed store, hash-verified

35// scaffold the workspace and module, then overwrites main.dang with the
36// provided source.
37func initDangModule(name, source string) dagger.WithContainerFunc {
38 return func(ctr *dagger.Container) *dagger.Container {
39 return ctr.
40 WithWorkdir("toolchains/"+name).
41 With(daggerExec("init", "--sdk=dang", "--name="+name)).
42 WithNewFile("main.dang", source).
43 WithWorkdir("../../").
44 With(daggerExec("init")).
45 With(daggerExec("toolchain", "install", "./toolchains/"+name))
46 }
47}
48
49// initStandaloneDangModule creates a standalone Dang module in the current
50// working directory and overwrites main.dang with the provided source.

Calls 4

daggerExecFunction · 0.85
WithMethod · 0.45
WithWorkdirMethod · 0.45
WithNewFileMethod · 0.45

Tested by

no test coverage detected