Fix no dependency inserted when previous array is empty

This commit is contained in:
Frederic Branczyk 2018-04-25 09:22:17 +01:00
parent f69df626e3
commit 51388f041b
No known key found for this signature in database
GPG key ID: 7741A52782A90069

View file

@ -111,6 +111,10 @@ func Install(ctx context.Context, m spec.JsonnetFile, dir string) (lock *spec.Js
}
func insertDependency(deps []spec.Dependency, newDep spec.Dependency) ([]spec.Dependency, error) {
if len(deps) == 0 {
return []spec.Dependency{newDep}, nil
}
res := []spec.Dependency{}
for _, d := range deps {
if d.Name == newDep.Name {