Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func hashDependency[D Dependency](dep D) dependencyHash {
}

func (ar *Resolver[R, D]) resolve() Releases[R, D] {
debug("deps to process: %s", ar.depsToProcess)
debug("deps to process: %v", ar.depsToProcess)
if len(ar.depsToProcess) == 0 {
debug("All dependencies have been resolved.")
var res Releases[R, D]
Expand All @@ -121,7 +121,7 @@ func (ar *Resolver[R, D]) resolve() Releases[R, D] {
// If a release is already picked in the solution check if it match the dep
if existingRelease, has := ar.solution[depName]; has {
if dep.GetConstraint().Match(existingRelease.GetVersion()) {
debug("%s already in solution and matching", existingRelease)
debug("%v already in solution and matching", existingRelease)
oldDepsToProcess := ar.depsToProcess
ar.depsToProcess = ar.depsToProcess[1:]
if res := ar.resolve(); res != nil {
Expand All @@ -130,7 +130,7 @@ func (ar *Resolver[R, D]) resolve() Releases[R, D] {
ar.depsToProcess = oldDepsToProcess
return nil
}
debug("%s already in solution do not match... rollingback", existingRelease)
debug("%v already in solution do not match... rolling back", existingRelease)
return nil
}

Expand All @@ -139,16 +139,16 @@ func (ar *Resolver[R, D]) resolve() Releases[R, D] {

// Consider the latest versions first
releases.SortDescent()
debug("releases matching criteria: %s", releases)
debug("releases matching criteria: %v", releases)

backtracking_loop:
for _, release := range releases {
releaseDeps := release.GetDependencies()
debug("try with %s %s", release, releaseDeps)
debug("try with %v %v", release, releaseDeps)

for _, releaseDep := range releaseDeps {
if _, ok := ar.releases[releaseDep.GetName()]; !ok {
debug("%s did not work, becuase his dependency %s does not exists", release, releaseDep.GetName())
debug("%v did not work, because its dependency %s does not exist", release, releaseDep.GetName())
continue backtracking_loop
}
}
Expand All @@ -166,7 +166,7 @@ backtracking_loop:
return res
}
ar.depsToProcess = oldDepsToProcess
debug("%s did not work...", release)
debug("%v did not work...", release)
delete(ar.solution, depName)
}

Expand Down
2 changes: 1 addition & 1 deletion resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestResolver(t *testing.T) {
i160 := rel("I", "1.6.0", deps())
i170 := rel("I", "1.7.0", deps())
i180 := rel("I", "1.8.0", deps())
arch := NewResolver[*customRel, *customDep]()
arch := NewResolver[*customRel]()

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewResolver is declared with two type parameters (NewResolver[R Release[D], D Dependency]()), so calling it with only one explicit type argument is likely to fail to compile. Either provide both type arguments here (as before), or change NewResolver's signature to a single type parameter if the dependency type is meant to be inferred.

Suggested change
arch := NewResolver[*customRel]()
arch := NewResolver[*customRel, *customDep]()

Copilot uses AI. Check for mistakes.
arch.AddReleases(
a100, a110, a111, a120, a121,
b131, b130, b121, b120, b111, b110, b100,
Expand Down
Loading