mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
do not close over variables in a function
This commit is contained in:
parent
e6a8dc0bcf
commit
8eb0b0f4ca
|
|
@ -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)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue