Hi,
I am working on moving a couple of our team's projects from the common Jenkinsfile/bash script setup to using Dagger.
We ended up with using the Go SDK that is provided.
I am not sure on how to formulate my problem, but I am giving it a go here.
Moving to dagger has gone well in the first project. For convenience, we have created utility packages inside the
internal subdirectory, as that seemed for us to be the right place to put them. These packages depend on the generated
dagger/<package>/internal/dagger Go package.
To hinder unnecessary code duplication, I wanted to see if it was possible to separate one of our utility packages into its own
Go module for better re-usability. In this process, I changed out the package's dagger dependency from dagger/<package>/internal/dagger to
dagger.io/dagger. For me, that made sense, since I did not want to have a separate Dagger module for this utility
package; I only wanted to depend on the Go SDK.
Note that this utility package is itself placed inside a private repository, like the rest of our team's projects.
This is where things started to go wrong: When I went ahead in trying to use this utility package, located inside its
own dagger-utils module, I get several error messages in the similar format below:
./main.go:139:14: cannot use <...> (value of type *"dagger.io/dagger".Container) as *"dagger/<package>/internal/dagger".Container value in assignment
I suppose that the error message makes completely sense, as the dagger module depends on a generated dagger package
whereas the imported module depends on the Go SDK available from dagger.io/dagger.
So my question boils down to: How can I create a common Go module that can depend on the Dagger Core API so I can have a
common module that can be re-used in Dagger modules spread out over multiple repositories?
Thanks!