Merge pull request #3 from hori-ryota/feature/fix-some-linterr

Fix some lint error
This commit is contained in:
c-bata 2017-08-16 18:31:44 +09:00 committed by GitHub
commit 4499cf5e08
4 changed files with 8 additions and 8 deletions

@ -11,11 +11,11 @@ func TestBisectRight(t *testing.T) {
r := BisectRight(in, 0) r := BisectRight(in, 0)
if r != 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) r = BisectRight(in, 4)
if r != 5 { 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)
} }
} }

@ -382,12 +382,12 @@ func TestDocument_OnLastLine(t *testing.T) {
CursorPosition: len("line 1\nline"), CursorPosition: len("line 1\nline"),
} }
ac := d.OnLastLine() ac := d.OnLastLine()
if ac != false { if ac {
t.Errorf("Should be %#v, got %#v", false, ac) t.Errorf("Should be %#v, got %#v", false, ac)
} }
d.CursorPosition = len("line 1\nline 2\nline") d.CursorPosition = len("line 1\nline 2\nline")
ac = d.OnLastLine() ac = d.OnLastLine()
if ac != true { if !ac {
t.Errorf("Should be %#v, got %#v", true, ac) t.Errorf("Should be %#v, got %#v", true, ac)
} }
} }

@ -54,7 +54,7 @@ func (t *VT100Parser) setRawMode() error {
n.Lflag &^= syscall.ECHO | syscall.ICANON | syscall.IEXTEN | syscall.ISIG n.Lflag &^= syscall.ECHO | syscall.ICANON | syscall.IEXTEN | syscall.ISIG
n.Cc[syscall.VMIN] = 1 n.Cc[syscall.VMIN] = 1
n.Cc[syscall.VTIME] = 0 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 return nil
} }
@ -67,7 +67,7 @@ func (t *VT100Parser) resetRawMode() error {
func (t *VT100Parser) GetKey(b []byte) Key { func (t *VT100Parser) GetKey(b []byte) Key {
for _, k := range asciiSequences { for _, k := range asciiSequences {
if bytes.Compare(k.ASCIICode, b) == 0 { if bytes.Equal(k.ASCIICode, b) {
return k.Key return k.Key
} }
} }

@ -195,11 +195,11 @@ func (w *VT100Writer) ClearTitle() {
func (w *VT100Writer) SetColor(fg, bg Color, bold bool) { func (w *VT100Writer) SetColor(fg, bg Color, bold bool) {
f, ok := foregroundANSIColors[fg] f, ok := foregroundANSIColors[fg]
if !ok { if !ok {
f, _ = foregroundANSIColors[DefaultColor] f = foregroundANSIColors[DefaultColor]
} }
b, ok := backgroundANSIColors[bg] b, ok := backgroundANSIColors[bg]
if !ok { if !ok {
b, _ = backgroundANSIColors[DefaultColor] b = backgroundANSIColors[DefaultColor]
} }
syscall.Write(syscall.Stdout, []byte{0x1b, 0x5b, 0x33, 0x39, 0x3b, 0x34, 0x39, 0x6d}) syscall.Write(syscall.Stdout, []byte{0x1b, 0x5b, 0x33, 0x39, 0x3b, 0x34, 0x39, 0x6d})
w.WriteRaw([]byte{0x1b, 0x5b}) w.WriteRaw([]byte{0x1b, 0x5b})