diff --git a/cmd/gorepomod/internal/repo/manager.go b/cmd/gorepomod/internal/repo/manager.go index d9ff899c7..c54df3fe2 100644 --- a/cmd/gorepomod/internal/repo/manager.go +++ b/cmd/gorepomod/internal/repo/manager.go @@ -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 })