summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony HAMON <anthony.hamon@iadvize.com>2018-08-21 22:17:34 +0200
committerAnthony HAMON <anthony.hamon@iadvize.com>2018-08-26 01:58:19 +0200
commit883fcf10838879839386091e6375c42b3f0b6a7d (patch)
tree1ad0d825b241e2f413cff4ad0ba00590d68b9f1e
parenta891bc90b78921a64e3abb901c4976788890013a (diff)
remove useless returned variable
-rw-r--r--pkg/commands/os.go8
-rw-r--r--pkg/gui/files_panel.go2
-rw-r--r--pkg/gui/status_panel.go3
3 files changed, 7 insertions, 6 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go
index 93c42796a..bc53ccf29 100644
--- a/pkg/commands/os.go
+++ b/pkg/commands/os.go
@@ -108,13 +108,13 @@ func (c *OSCommand) SublimeOpenFile(filename string) (*exec.Cmd, error) {
}
// OpenFile opens a file with the given
-func (c *OSCommand) OpenFile(filename string) (*exec.Cmd, error) {
+func (c *OSCommand) OpenFile(filename string) error {
cmdName, cmdTrail, err := c.GetOpenCommand()
if err != nil {
- return nil, err
+ return err
}
- err = c.RunCommand(cmdName + " " + c.Quote(filename) + cmdTrail) // TODO: test on linux
- return nil, err
+
+ return c.RunCommand(cmdName + " " + c.Quote(filename) + cmdTrail) // TODO: test on linux
}
// EditFile opens a file in a subprocess using whatever editor is available,
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 5791a9d15..2f5db9aff 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -256,7 +256,7 @@ func (gui *Gui) handleFileOpen(g *gocui.Gui, v *gocui.View) error {
if err != nil {
return err
}
- return gui.genericFileOpen(g, v, file.Name, gui.OSCommand.OpenFile)
+ return gui.genericFileOpen(g, v, file.Name, func(filename string) (*exec.Cmd, error) { return nil, gui.OSCommand.OpenFile(filename) })
}
func (gui *Gui) handleSublimeFileOpen(g *gocui.Gui, v *gocui.View) error {
diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go
index 88134096e..27e0aba5b 100644
--- a/pkg/gui/status_panel.go
+++ b/pkg/gui/status_panel.go
@@ -2,6 +2,7 @@ package gui
import (
"fmt"
+ "os/exec"
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
@@ -66,7 +67,7 @@ func (gui *Gui) handleStatusSelect(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleOpenConfig(g *gocui.Gui, v *gocui.View) error {
filename := gui.Config.GetUserConfig().ConfigFileUsed()
- return gui.genericFileOpen(g, v, filename, gui.OSCommand.OpenFile)
+ return gui.genericFileOpen(g, v, filename, func(filename string) (*exec.Cmd, error) { return nil, gui.OSCommand.OpenFile(filename) })
}
func (gui *Gui) handleEditConfig(g *gocui.Gui, v *gocui.View) error {