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)
| 35 | // scaffold the workspace and module, then overwrites main.dang with the |
| 36 | // provided source. |
| 37 | func 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. |
no test coverage detected