Skip to content

Commit

Permalink
append unique
Browse files Browse the repository at this point in the history
  • Loading branch information
Equanox committed Jan 3, 2023
1 parent ce64f16 commit 93921eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bob/bobfile/bobfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ func initializeDependencies(dir string, taskDependencies []string, bobfile *Bobf

taskDeps := make([]nix.Dependency, 0)
for _, v := range dependencies {
taskDeps = append(taskDeps, nix.Dependency{
taskDeps = nix.AppendUnique(taskDeps, nix.Dependency{
Name: v,
Nixpkgs: bobfile.Nixpkgs,
})
}

return nix.UniqueDeps(taskDeps)
return taskDeps
}

func NewRemotestore(endpoint *url.URL, allowInsecure bool, token string) (s store.Store) {
Expand Down
9 changes: 9 additions & 0 deletions pkg/nix/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ func UniqueDeps(s []Dependency) []Dependency {
}
return res
}

func AppendUnique(a []Dependency, x Dependency) []Dependency {
for _, y := range a {
if x.Name+x.Nixpkgs == y.Name+y.Nixpkgs {
return a
}
}
return append(a, x)
}

0 comments on commit 93921eb

Please sign in to comment.