summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-09-13 14:10:09 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-09-13 14:10:09 +0200
commit2eaf8b69e82603093b56ace5fdedbdc0249e77a0 (patch)
tree22ecc819dd52808dae66eb4017618df6877e2de9
parentRandom code improvements/tidying (diff)
More lints
Diffstat (limited to '')
-rw-r--r--commands.go4
-rw-r--r--irc/tokens.go11
-rw-r--r--irc/typing.go2
-rw-r--r--ui/editor_test.go6
-rw-r--r--ui/style.go2
-rw-r--r--ui/style_test.go20
6 files changed, 19 insertions, 26 deletions
diff --git a/commands.go b/commands.go
index 78cb780..bc6a2c7 100644
--- a/commands.go
+++ b/commands.go
@@ -296,9 +296,9 @@ func commandDoNick(app *App, buffer string, args []string) (err error) {
func commandDoMode(app *App, buffer string, args []string) (err error) {
channel := args[0]
flags := args[1]
- mode_args := args[2:]
+ modeArgs := args[2:]
- app.s.ChangeMode(channel, flags, mode_args)
+ app.s.ChangeMode(channel, flags, modeArgs)
return
}
diff --git a/irc/tokens.go b/irc/tokens.go
index aa5d4b6..f7569a1 100644
--- a/irc/tokens.go
+++ b/irc/tokens.go
@@ -22,7 +22,7 @@ func CasemapASCII(name string) string {
return sb.String()
}
-// CasemapASCII of name is the canonical representation of name according to the
+// CasemapRFC1459 of name is the canonical representation of name according to the
// rfc-1459 casemapping.
func CasemapRFC1459(name string) string {
var sb strings.Builder
@@ -57,7 +57,7 @@ func word(s string) (word, rest string) {
return
}
-// tagEscape returns the the value of '\c' given c according to the message-tags
+// tagEscape returns the value of '\c' given c according to the message-tags
// specification.
func tagEscape(c rune) (escape rune) {
switch c {
@@ -157,13 +157,6 @@ var (
errIncompleteMessage = errors.New("message is incomplete")
)
-var (
- errEmptyBatchID = errors.New("empty BATCH ID")
- errNoPrefix = errors.New("missing prefix")
- errNotEnoughParams = errors.New("not enough params")
- errUnknownCommand = errors.New("unknown command")
-)
-
type Prefix struct {
Name string
User string
diff --git a/irc/typing.go b/irc/typing.go
index 5a3073c..fd1576c 100644
--- a/irc/typing.go
+++ b/irc/typing.go
@@ -69,7 +69,7 @@ func (ts *Typings) Active(target, name string) {
}()
}
-// Active should be called when a user is done typing to some target.
+// Done should be called when a user is done typing to some target.
func (ts *Typings) Done(target, name string) {
ts.l.Lock()
delete(ts.targets, Typing{target, name})
diff --git a/ui/editor_test.go b/ui/editor_test.go
index d670e0e..733f633 100644
--- a/ui/editor_test.go
+++ b/ui/editor_test.go
@@ -2,8 +2,8 @@ package ui
import "testing"
-var hell Editor = Editor{
- text: [][]rune{[]rune{'h', 'e', 'l', 'l'}},
+var hell = Editor{
+ text: [][]rune{{'h', 'e', 'l', 'l'}},
textWidth: []int{0, 1, 2, 3, 4},
cursorIdx: 4,
offsetIdx: 0,
@@ -55,7 +55,7 @@ func TestOneLetter(t *testing.T) {
e.Resize(5)
e.PutRune('h')
assertEditorEq(t, e, Editor{
- text: [][]rune{[]rune{'h'}},
+ text: [][]rune{{'h'}},
textWidth: []int{0, 1},
cursorIdx: 1,
offsetIdx: 0,
diff --git a/ui/style.go b/ui/style.go
index f596ac0..76ca3f0 100644
--- a/ui/style.go
+++ b/ui/style.go
@@ -10,7 +10,7 @@ import (
"github.com/mattn/go-runewidth"
)
-var condition runewidth.Condition = runewidth.Condition{}
+var condition = runewidth.Condition{}
func runeWidth(r rune) int {
return condition.RuneWidth(r)
diff --git a/ui/style_test.go b/ui/style_test.go
index 4ba2e9d..d6846a7 100644
--- a/ui/style_test.go
+++ b/ui/style_test.go
@@ -35,62 +35,62 @@ func TestIRCString(t *testing.T) {
assertIRCString(t, "\x02hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Bold(true)},
+ {Start: 0, Style: tcell.StyleDefault.Bold(true)},
},
})
assertIRCString(t, "\x035hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
},
})
assertIRCString(t, "\x0305hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
},
})
assertIRCString(t, "\x0305,0hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
},
})
assertIRCString(t, "\x035,00hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
},
})
assertIRCString(t, "\x0305,00hello", StyledString{
string: "hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
},
})
assertIRCString(t, "\x035,hello", StyledString{
string: ",hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
},
})
assertIRCString(t, "\x0305,hello", StyledString{
string: ",hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
},
})
assertIRCString(t, "\x03050hello", StyledString{
string: "0hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
},
})
assertIRCString(t, "\x0305,000hello", StyledString{
string: "0hello",
styles: []rangedStyle{
- rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
+ {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
},
})
}