#functions vs modules tutorial

1 messages · Page 1 of 1 (latest)

keen solstice
#

I had trouble getting set up with a brand new repo cause I was trying to do from scratch instead of the template repo.

So that's my own fault 😜

So can someone clarify are dagger functions multi module structured rather than one go module and independently versionable because of this?

  • Ie does a dagger module equate to a go module or is it each function equates to its own go module (aka a repo would then be a multi module repo in Go terms)
  • should the dagger.json sit in the same directory as the function then?
frank haven
#

If you develop a Dagger module in Go, it will map to a Go module

#

The location of the module's source code relative to the root of the module (dagger.json) can be configured with the source field:

  • "source": "." means look for the source code at the root of the module
  • "source": "./foo" means look for the source code in ./foo relative to the dagger module

Note that the module source code cannot be outside the module root (no ../)

You can control this with dagger develop --source=PATH

#

For a dagger module that doesn't share the repo with other applications (ie. not embedded in a wider repo), I recommend "source": ".", more straightforward