Simplify gorepomod manager

This commit is contained in:
Jeff Regan
2021-02-11 15:25:19 -08:00
committed by GitHub
parent 38b30b0edc
commit dbbe340b4f

View File

@@ -55,15 +55,12 @@ func (mgr *Manager) Pin(
func (mgr *Manager) UnPin(
doIt bool, target misc.LaModule, conditional misc.LaModule) error {
if conditional == nil {
conditional = target
}
return mgr.modules.Apply(func(m misc.LaModule) error {
if conditional == nil {
if yes, oldVersion := m.DependsOn(target); yes {
return edit.New(m, doIt).UnPin(target, oldVersion)
}
} else {
if yes, oldVersion := m.DependsOn(conditional); yes {
return edit.New(m, doIt).UnPin(target, oldVersion)
}
if yes, oldVersion := m.DependsOn(conditional); yes {
return edit.New(m, doIt).UnPin(target, oldVersion)
}
return nil
})