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:
Ryan Boehning
2018-02-17 14:01:06 -08:00
committed by Junegunn Choi
parent 24236860c8
commit 21b94d2de5
7 changed files with 41 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
package util
import (
"fmt"
"unicode"
"unicode/utf8"
"unsafe"
@@ -94,6 +95,11 @@ func (chars *Chars) Length() int {
return len(chars.slice)
}
// String returns the string representation of a Chars object.
func (chars *Chars) String() string {
return fmt.Sprintf("Chars{slice: []byte(%q), inBytes: %v, trimLengthKnown: %v, trimLength: %d, Index: %d}", chars.slice, chars.inBytes, chars.trimLengthKnown, chars.trimLength, chars.Index)
}
// TrimLength returns the length after trimming leading and trailing whitespaces
func (chars *Chars) TrimLength() uint16 {
if chars.trimLengthKnown {