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,16 +55,13 @@ func (mgr *Manager) Pin(
func (mgr *Manager) UnPin( func (mgr *Manager) UnPin(
doIt bool, target misc.LaModule, conditional misc.LaModule) error { doIt bool, target misc.LaModule, conditional misc.LaModule) error {
return mgr.modules.Apply(func(m misc.LaModule) error {
if conditional == nil { if conditional == nil {
if yes, oldVersion := m.DependsOn(target); yes { conditional = target
return edit.New(m, doIt).UnPin(target, oldVersion)
} }
} else { return mgr.modules.Apply(func(m misc.LaModule) error {
if yes, oldVersion := m.DependsOn(conditional); yes { if yes, oldVersion := m.DependsOn(conditional); yes {
return edit.New(m, doIt).UnPin(target, oldVersion) return edit.New(m, doIt).UnPin(target, oldVersion)
} }
}
return nil return nil
}) })
} }