diff options
author | Ryan Boehning <ryanboehning@gmail.com> | 2018-02-17 14:01:06 -0800 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2018-03-13 14:56:55 +0900 |
commit | 21b94d2de5bdf2d8c4e8107e4c197a2abc1e7275 (patch) | |
tree | d7255fcd66e512a40016ac220d84574f22c0d551 /src/util/chars.go | |
parent | 24236860c89242ac0a341ff911c93f25032dc051 (diff) |
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
Diffstat (limited to 'src/util/chars.go')
-rw-r--r-- | src/util/chars.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 { |