style: deduplicate types in function signatures (#2322)
This commit is contained in:
1 parent
d8b9026ef2
commit
eb01cb7c7b
6 files changed
+11
-11
No files matched your search
@@ -86,7 +86,7 @@ func run() {
|
||||
}
|
||||
}
|
||||
|
||||
func writeLastDir(filename string, lastDir string) {
|
||||
func writeLastDir(filename, lastDir string) {
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
log.Printf("opening last dir file: %s", err)
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ func matchCmd(s string) (matches []compMatch, result string) {
|
||||
return
|
||||
}
|
||||
|
||||
func matchFile(s string, dirOnly bool, escape func(string) string, unescape func(string) string) (matches []compMatch, result string) {
|
||||
func matchFile(s string, dirOnly bool, escape, unescape func(string) string) (matches []compMatch, result string) {
|
||||
dir, file := filepath.Split(unescape(replaceTilde(s)))
|
||||
|
||||
d := dir
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ func TestRemoveDiacritics(t *testing.T) {
|
||||
checkRemoveDiacritics(testStr, expStr, t)
|
||||
}
|
||||
|
||||
func checkRemoveDiacritics(testStr string, expStr string, t *testing.T) {
|
||||
func checkRemoveDiacritics(testStr, expStr string, t *testing.T) {
|
||||
resultStr := removeDiacritics(testStr)
|
||||
if resultStr != expStr {
|
||||
t.Errorf("at input '%v' expected '%v' but got '%v'", testStr, expStr, resultStr)
|
||||
|
||||
@@ -408,7 +408,7 @@ func getFileExtension(file fs.FileInfo) string {
|
||||
// character will appear (0 means left, 50 means middle, 100 means right).
|
||||
// The file extension is not affected by truncation, however it will be clipped
|
||||
// if it exceeds the allowed width.
|
||||
func truncateFilename(file fs.FileInfo, maxWidth int, truncatePct int, truncateChar rune) string {
|
||||
func truncateFilename(file fs.FileInfo, maxWidth, truncatePct int, truncateChar rune) string {
|
||||
filename := file.Name()
|
||||
if runeSliceWidth([]rune(filename)) <= maxWidth {
|
||||
return filename
|
||||
|
||||
@@ -1271,7 +1271,7 @@ func (nav *nav) toggle() {
|
||||
nav.toggleSelection(curr.path)
|
||||
}
|
||||
|
||||
func (nav *nav) tagToggleSelection(path string, tag string) {
|
||||
func (nav *nav) tagToggleSelection(path, tag string) {
|
||||
if _, ok := nav.tags[path]; ok {
|
||||
delete(nav.tags, path)
|
||||
} else {
|
||||
|
||||
@@ -277,7 +277,7 @@ func infotimefmt(t time.Time) string {
|
||||
return t.Format(gOpts.infotimefmtold)
|
||||
}
|
||||
|
||||
func fileInfo(f *file, d *dir, userWidth int, groupWidth int, customWidth int) (string, string, int) {
|
||||
func fileInfo(f *file, d *dir, userWidth, groupWidth, customWidth int) (string, string, int) {
|
||||
var info strings.Builder
|
||||
var custom string
|
||||
var off int
|
||||
@@ -549,7 +549,7 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
|
||||
}
|
||||
}
|
||||
|
||||
func getUserWidth(dir *dir, beg int, end int) int {
|
||||
func getUserWidth(dir *dir, beg, end int) int {
|
||||
maxw := 0
|
||||
|
||||
for _, f := range dir.files[beg:end] {
|
||||
@@ -559,7 +559,7 @@ func getUserWidth(dir *dir, beg int, end int) int {
|
||||
return maxw
|
||||
}
|
||||
|
||||
func getGroupWidth(dir *dir, beg int, end int) int {
|
||||
func getGroupWidth(dir *dir, beg, end int) int {
|
||||
maxw := 0
|
||||
|
||||
for _, f := range dir.files[beg:end] {
|
||||
@@ -569,7 +569,7 @@ func getGroupWidth(dir *dir, beg int, end int) int {
|
||||
return maxw
|
||||
}
|
||||
|
||||
func getCustomWidth(dir *dir, beg int, end int) int {
|
||||
func getCustomWidth(dir *dir, beg, end int) int {
|
||||
maxw := 0
|
||||
|
||||
for _, f := range dir.files[beg:end] {
|
||||
@@ -835,7 +835,7 @@ func (ui *ui) drawPromptLine(nav *nav) {
|
||||
ui.promptWin.print(ui.screen, 0, 0, st, prompt)
|
||||
}
|
||||
|
||||
func formatRulerOpt(name string, val string) string {
|
||||
func formatRulerOpt(name, val string) string {
|
||||
// handle escape character so it doesn't mess up the ruler
|
||||
val = strings.ReplaceAll(val, "\033", "\033[7m\\033\033[0m")
|
||||
|
||||
@@ -865,7 +865,7 @@ func (ui *ui) drawStat(nav *nav) {
|
||||
}
|
||||
|
||||
statfmt := strings.ReplaceAll(gOpts.statfmt, "|", "\x1f")
|
||||
replace := func(s string, val string) {
|
||||
replace := func(s, val string) {
|
||||
if val == "" {
|
||||
val = "\x00"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user