mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-01-03 22:39:23 +03:00
do not close over variables in a function
This commit is contained in:
@@ -16,10 +16,12 @@ func (gui *Gui) handleCreateRebaseOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
||||
|
||||
menuItems := make([]*menuItem, len(options))
|
||||
for i, option := range options {
|
||||
// note to self. Never, EVER, close over loop variables in a function
|
||||
innerOption := option
|
||||
menuItems[i] = &menuItem{
|
||||
displayString: option,
|
||||
displayString: innerOption,
|
||||
onPress: func() error {
|
||||
return gui.genericMergeCommand(option)
|
||||
return gui.genericMergeCommand(innerOption)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user