make linter happier

This commit is contained in:
Lilian Jónsdóttir 2024-07-31 00:13:48 -07:00
parent 747a24ebd6
commit 98a5044662
6 changed files with 21 additions and 28 deletions

View file

@ -10,7 +10,7 @@ import (
const sep = string(os.PathSeparator) const sep = string(os.PathSeparator)
var ( var (
home string = os.Getenv("HOME") home = os.Getenv("HOME")
pwd, _ = os.Getwd() pwd, _ = os.Getwd()
) )

View file

@ -27,9 +27,8 @@ func SortByModified(a, b File) int {
return 1 return 1
} else if a.Date().After(b.Date()) { } else if a.Date().After(b.Date()) {
return -1 return -1
} else {
return 0
} }
return 0
} }
func SortByModifiedReverse(a, b File) int { func SortByModifiedReverse(a, b File) int {
@ -37,9 +36,8 @@ func SortByModifiedReverse(a, b File) int {
return 1 return 1
} else if a.Date().Before(b.Date()) { } else if a.Date().Before(b.Date()) {
return -1 return -1
} else {
return 0
} }
return 0
} }
func SortBySize(a, b File) int { func SortBySize(a, b File) int {
@ -87,9 +85,8 @@ func SortDirectoriesFirst(a, b File) int {
return 1 return 1
} else if a.IsDir() && !b.IsDir() { } else if a.IsDir() && !b.IsDir() {
return -1 return -1
} else {
return 0
} }
return 0
} }
func SortDirectoriesLast(a, b File) int { func SortDirectoriesLast(a, b File) int {
@ -97,9 +94,8 @@ func SortDirectoriesLast(a, b File) int {
return 1 return 1
} else if !a.IsDir() && b.IsDir() { } else if !a.IsDir() && b.IsDir() {
return -1 return -1
} else {
return 0
} }
return 0
} }
func doNameSort(a, b File) int { func doNameSort(a, b File) int {
@ -119,7 +115,6 @@ func doNameSort(a, b File) int {
func getSortingSize(f File) int64 { func getSortingSize(f File) int64 {
if f.IsDir() { if f.IsDir() {
return -1 return -1
} else {
return f.Filesize()
} }
return f.Filesize()
} }

View file

@ -296,7 +296,8 @@ func ensureUniqueName(filename, trashDir string) (string, string) {
// doesn't exist, so use it // doesn't exist, so use it
path := filepath.Join(filedir, filename) path := filepath.Join(filedir, filename)
return info, path return info, path
} else { }
// otherwise, try random suffixes until one works // otherwise, try random suffixes until one works
log.Debugf("%s exists in trash, generating random name", filename) log.Debugf("%s exists in trash, generating random name", filename)
var tries int var tries int
@ -310,5 +311,4 @@ func ensureUniqueName(filename, trashDir string) (string, string) {
return newName, path return newName, path
} }
} }
}
} }

View file

@ -312,7 +312,6 @@ func (m model) View() string {
} }
func (m model) showHelp() string { func (m model) showHelp() string {
// TODO: maybe use bubbletea built in help
var filterText string var filterText string
if m.filter != "" { if m.filter != "" {
filterText = fmt.Sprintf(" (%s)", m.filter) filterText = fmt.Sprintf(" (%s)", m.filter)

View file

@ -11,8 +11,6 @@ import (
"golang.org/x/term" "golang.org/x/term"
) )
// TODO: use charm stuff for this
func YesNo(prompt string) bool { func YesNo(prompt string) bool {
return AskRune(prompt, "y/n") == 'y' return AskRune(prompt, "y/n") == 'y'
} }

View file

@ -1,3 +1,4 @@
// Package main does the thing
package main package main
import ( import (