Repository navigation
Closed
Labels
Description
It's possible to have multiple dependencies with the same name in dagger.json:
$ dagger init --name=test --sdk=go
$ dagger install github.com/shykes/gha
$ dagger install github.com/heuritech/gha
The resulting dagger.json:
{
"name": "test",
"sdk": "go",
"dependencies": [
{
"name": "gha",
"source": "github.com/heuritech/gha@strategy",
"pin": "f0c4da95fb3e7e5351d17dfb1d20362d3ae8b2a2"
},
{
"name": "gha",
"source": "github.com/shykes/gha",
"pin": "f6c91e490043946d71100645be8253471ba626bd"
}
],
"source": ".",
"engineVersion": "v0.13.6"
}This is happening because the existing de-duping logic only handles the "symbolic" name: github.com/heuritech/gha and github.com/shykes/gha - we're entirely ignoring the names.
dagger/core/schema/modulesource.go
Lines 557 to 574 in d4d7591
| // figure out the set of deps, keyed by their symbolic ref string, which de-dupes | |
| // equivalent sources at different versions, preferring the version provided | |
| // in the dependencies arg here | |
| depSet := make(map[string]dagql.Instance[*core.ModuleDependency]) | |
| for _, dep := range existingDeps { | |
| symbolic, err := dep.Self.Source.Self.Symbolic() | |
| if err != nil { | |
| return nil, fmt.Errorf("failed to get symbolic source ref: %w", err) | |
| } | |
| depSet[symbolic] = dep | |
| } | |
| for _, dep := range newDeps { | |
| symbolic, err := dep.Self.Source.Self.Symbolic() | |
| if err != nil { | |
| return nil, fmt.Errorf("failed to get symbolic source ref: %w", err) | |
| } | |
| depSet[symbolic] = dep | |
| } |
Activity