Miscellaneous tweaks and fixes (#2223)

* Miscellaneous tweaks and fixes

Mostly these were found by running golangci-lint with a bunch of linters
(more than the default set) enabled.

* fmt.Fprint -> fmt.Fprintln where possible

* Remove "nolint:staticcheck" for now
This commit is contained in:
Carlo Teubner authored and GitHub committed 2025-10-28 15:10:32 +11:00
1 parent b12cb33918
commit fc4b3637bb
11 files changed
+105 -108

No files matched your search

+11 -13
View File
@@ -57,7 +57,7 @@ func applyLocalBoolOpt(localOpt map[string]bool, globalOpt bool, e *setLocalExpr
return nil
}
func (e *setExpr) eval(app *app, args []string) {
func (e *setExpr) eval(app *app, _ []string) {
var err error
switch e.opt {
case "anchorfind", "noanchorfind", "anchorfind!":
@@ -467,7 +467,7 @@ func (e *setExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *setLocalExpr) eval(app *app, args []string) {
func (e *setLocalExpr) eval(app *app, _ []string) {
e.path = replaceTilde(e.path)
if !filepath.IsAbs(e.path) {
app.ui.echoerr("setlocal: path should be absolute")
@@ -542,7 +542,7 @@ func (e *setLocalExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *mapExpr) eval(app *app, args []string) {
func (e *mapExpr) eval(app *app, _ []string) {
if e.expr == nil {
delete(gOpts.nkeys, e.keys)
delete(gOpts.vkeys, e.keys)
@@ -553,7 +553,7 @@ func (e *mapExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *nmapExpr) eval(app *app, args []string) {
func (e *nmapExpr) eval(app *app, _ []string) {
if e.expr == nil {
delete(gOpts.nkeys, e.keys)
} else {
@@ -562,7 +562,7 @@ func (e *nmapExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *vmapExpr) eval(app *app, args []string) {
func (e *vmapExpr) eval(app *app, _ []string) {
if e.expr == nil {
delete(gOpts.vkeys, e.keys)
} else {
@@ -571,7 +571,7 @@ func (e *vmapExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *cmapExpr) eval(app *app, args []string) {
func (e *cmapExpr) eval(app *app, _ []string) {
if e.expr == nil {
delete(gOpts.cmdkeys, e.key)
} else {
@@ -580,7 +580,7 @@ func (e *cmapExpr) eval(app *app, args []string) {
app.ui.echo("")
}
func (e *cmdExpr) eval(app *app, args []string) {
func (e *cmdExpr) eval(app *app, _ []string) {
if e.expr == nil {
delete(gOpts.cmds, e.name)
} else {
@@ -976,7 +976,7 @@ func exitCompMenu(app *app) {
app.menuCompActive = false
}
func (e *callExpr) eval(app *app, args []string) {
func (e *callExpr) eval(app *app, _ []string) {
os.Setenv("lf_count", strconv.Itoa(e.count))
switch e.name {
@@ -1301,9 +1301,7 @@ func (e *callExpr) eval(app *app, args []string) {
if !app.nav.init {
return
}
if err := app.nav.reload(); err != nil {
app.ui.echoerrf("reload: %s", err)
}
app.nav.reload()
app.ui.loadFile(app, true)
case "delete":
if !app.nav.init {
@@ -1776,7 +1774,7 @@ func (e *callExpr) eval(app *app, args []string) {
tty, ok := app.ui.screen.Tty()
if !ok {
log.Printf("tty-write: failed to get tty")
log.Print("tty-write: failed to get tty")
return
}
@@ -2316,7 +2314,7 @@ func (e *execExpr) eval(app *app, args []string) {
}
}
func (e *listExpr) eval(app *app, args []string) {
func (e *listExpr) eval(app *app, _ []string) {
for range e.count {
for _, expr := range e.exprs {
expr.eval(app, nil)