diff --git a/bisect_test.go b/bisect_test.go index 0baed7c..ff51c2f 100644 --- a/bisect_test.go +++ b/bisect_test.go @@ -11,11 +11,11 @@ func TestBisectRight(t *testing.T) { r := BisectRight(in, 0) if r != 0 { - t.Error("number 0 should inserted at 0 position, but got %d", r) + t.Errorf("number 0 should inserted at 0 position, but got %d", r) } r = BisectRight(in, 4) if r != 5 { - t.Error("number 4 should inserted at 5 position, but got %d", r) + t.Errorf("number 4 should inserted at 5 position, but got %d", r) } } diff --git a/document_test.go b/document_test.go index ca04716..001dad0 100644 --- a/document_test.go +++ b/document_test.go @@ -382,12 +382,12 @@ func TestDocument_OnLastLine(t *testing.T) { CursorPosition: len("line 1\nline"), } ac := d.OnLastLine() - if ac != false { + if ac { t.Errorf("Should be %#v, got %#v", false, ac) } d.CursorPosition = len("line 1\nline 2\nline") ac = d.OnLastLine() - if ac != true { + if !ac { t.Errorf("Should be %#v, got %#v", true, ac) } } diff --git a/vt100_input.go b/vt100_input.go index daf965b..155f3cc 100644 --- a/vt100_input.go +++ b/vt100_input.go @@ -54,7 +54,7 @@ func (t *VT100Parser) setRawMode() error { n.Lflag &^= syscall.ECHO | syscall.ICANON | syscall.IEXTEN | syscall.ISIG n.Cc[syscall.VMIN] = 1 n.Cc[syscall.VTIME] = 0 - termios.Tcsetattr(uintptr(t.fd), termios.TCSANOW, (*syscall.Termios)(&n)) + termios.Tcsetattr(uintptr(t.fd), termios.TCSANOW, &n) return nil } @@ -67,7 +67,7 @@ func (t *VT100Parser) resetRawMode() error { func (t *VT100Parser) GetKey(b []byte) Key { for _, k := range asciiSequences { - if bytes.Compare(k.ASCIICode, b) == 0 { + if bytes.Equal(k.ASCIICode, b) { return k.Key } } diff --git a/vt100_output.go b/vt100_output.go index fd7349d..12c6fd9 100644 --- a/vt100_output.go +++ b/vt100_output.go @@ -195,11 +195,11 @@ func (w *VT100Writer) ClearTitle() { func (w *VT100Writer) SetColor(fg, bg Color, bold bool) { f, ok := foregroundANSIColors[fg] if !ok { - f, _ = foregroundANSIColors[DefaultColor] + f = foregroundANSIColors[DefaultColor] } b, ok := backgroundANSIColors[bg] if !ok { - b, _ = backgroundANSIColors[DefaultColor] + b = backgroundANSIColors[DefaultColor] } syscall.Write(syscall.Stdout, []byte{0x1b, 0x5b, 0x33, 0x39, 0x3b, 0x34, 0x39, 0x6d}) w.WriteRaw([]byte{0x1b, 0x5b})