From 21b94d2de5bdf2d8c4e8107e4c197a2abc1e7275 Mon Sep 17 00:00:00 2001 From: Ryan Boehning Date: Sat, 17 Feb 2018 14:01:06 -0800 Subject: 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 --- src/util/chars.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/util') diff --git a/src/util/chars.go b/src/util/chars.go index 9e58313b..ec6fca0e 100644 --- a/src/util/chars.go +++ b/src/util/chars.go @@ -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 { -- cgit v1.2.3