From 95a952100a469fd012f9d281a03a0e0715bf7744 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Tue, 26 Nov 2024 14:28:32 +0900 Subject: [PATCH] Fix lint issues --- main.go | 2 +- oviewer/action.go | 6 ++++-- oviewer/filter.go | 2 +- oviewer/oviewer.go | 3 +-- oviewer/ovstyle.go | 20 ++++++++++---------- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index ade6e6c2..e5870d5c 100644 --- a/main.go +++ b/main.go @@ -160,7 +160,7 @@ func Completion(cmd *cobra.Command, arg string) error { // argsToFiles returns the file name from the argument. func argsToFiles(args []string) []string { - var files []string + files := make([]string, 0, len(args)) for _, arg := range args { argFiles, err := filepath.Glob(arg) if err != nil { diff --git a/oviewer/action.go b/oviewer/action.go index f7f18a02..08a35c90 100644 --- a/oviewer/action.go +++ b/oviewer/action.go @@ -374,9 +374,11 @@ func (root *Root) suspend(context.Context) { root.setMessageLog(err.Error()) return } - defer func() error { + defer func() { log.Println("Resume") - return root.Screen.Resume() + if err := root.Screen.Resume(); err != nil { + log.Println(err) + } }() subshell := os.Getenv("OV_SUBSHELL") diff --git a/oviewer/filter.go b/oviewer/filter.go index 1f818f30..b9294793 100644 --- a/oviewer/filter.go +++ b/oviewer/filter.go @@ -71,7 +71,7 @@ func (root *Root) filterDocument(ctx context.Context, searcher Searcher) { writeLine(w, line) } go m.filterWriter(ctx, searcher, m.firstLine(), filterDoc) - root.setMessagef(msg) + root.setMessage(msg) } // filterWriter searches and writes to filterDoc. diff --git a/oviewer/oviewer.go b/oviewer/oviewer.go index 094cfc91..fff24233 100644 --- a/oviewer/oviewer.go +++ b/oviewer/oviewer.go @@ -2,6 +2,7 @@ package oviewer import ( "context" + "errors" "fmt" "io" "log" @@ -12,8 +13,6 @@ import ( "sync" "syscall" - "errors" - "code.rocketnine.space/tslocum/cbind" "github.com/fsnotify/fsnotify" "github.com/gdamore/tcell/v2" diff --git a/oviewer/ovstyle.go b/oviewer/ovstyle.go index 37e58dd6..263d1e3a 100644 --- a/oviewer/ovstyle.go +++ b/oviewer/ovstyle.go @@ -72,17 +72,17 @@ func applyStyle(style tcell.Style, s OVStyle) tcell.Style { style = style.Background(tcell.GetColor(s.Background)) } // tcell does not support underline color. - //if s.UnderlineColor != "" { + // if s.UnderlineColor != "" { // style = style.UnderlineColor(tcell.GetColor(s.UnderlineColor)) - //} + // } // tcell does not support underline type. - //if s.UnderlineType != 0 { + // if s.UnderlineType != 0 { // Double,Curly,Dotted,Dashed - //} + // } // tcell does not support vertical align type. - //if s.VerticalAlignType != 0 { + // if s.VerticalAlignType != 0 { // Top,Middle,Bottom - //} + // } if s.Blink { style = style.Blink(true) @@ -106,9 +106,9 @@ func applyStyle(style tcell.Style, s OVStyle) tcell.Style { style = style.StrikeThrough(true) } // tcell does not support overline. - //if s.OverLine { + // if s.OverLine { // style = style.Overline(true) - //} + // } if s.UnBlink { style = style.Blink(false) @@ -132,9 +132,9 @@ func applyStyle(style tcell.Style, s OVStyle) tcell.Style { style = style.StrikeThrough(false) } // tcell does not support overline. - //if s.UnOverLine { + // if s.UnOverLine { // style = style.Overline(false) - //} + // } return style }