mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 12:42:01 -07:00
Make fzf pass go vet
Add String() methods to types, so they can be printed with %s. Change some %s format specifiers to %v, when the default string representation is good enough. In Go 1.10, `go test` triggers a parallel `go vet`. So this also makes fzf pass `go test`. Close #1236 Close #1219
This commit is contained in:
committed by
Junegunn Choi
parent
24236860c8
commit
21b94d2de5
@@ -2,6 +2,7 @@ package fzf
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -23,12 +24,22 @@ type Token struct {
|
||||
prefixLength int32
|
||||
}
|
||||
|
||||
// String returns the string representation of a Token.
|
||||
func (t Token) String() string {
|
||||
return fmt.Sprintf("Token{text: %s, prefixLength: %d}", t.text, t.prefixLength)
|
||||
}
|
||||
|
||||
// Delimiter for tokenizing the input
|
||||
type Delimiter struct {
|
||||
regex *regexp.Regexp
|
||||
str *string
|
||||
}
|
||||
|
||||
// String returns the string representation of a Delimeter.
|
||||
func (d Delimiter) String() string {
|
||||
return fmt.Sprintf("Delimiter{regex: %v, str: &%q}", d.regex, *d.str)
|
||||
}
|
||||
|
||||
func newRange(begin int, end int) Range {
|
||||
if begin == 1 {
|
||||
begin = rangeEllipsis
|
||||
|
Reference in New Issue
Block a user