From 082c018f533268fedd4e01ca4287ac59ecc01070 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sun, 8 Mar 2026 18:40:59 -0400 Subject: [PATCH] style: run golangci-lint run --fix --- internal/cache/cache.go | 2 +- internal/config/theme.go | 19 +++++++------------ internal/ui/chat/mentions_list.go | 2 +- internal/ui/chat/message_input.go | 3 +-- internal/ui/chat/messages_list.go | 2 +- internal/ui/chat/view.go | 2 +- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 9c4e5e7..cfd1b28 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -31,7 +31,7 @@ func (c *Cache) Get(query string) uint { // the search limit. // "aa", "ab", "ac", ..., "ay" // where length is longer than the limit // if "ay" leaves, then "az" would not be loaded becaue it would not be -// returned by the search results because of the search limit +// returned by the search results because of the search limit. func (c *Cache) Invalidate(name string, limit uint) { for name != "" { if c.Exists(name) && c.Get(name) >= limit { diff --git a/internal/config/theme.go b/internal/config/theme.go index 7af25ba..67b3d43 100644 --- a/internal/config/theme.go +++ b/internal/config/theme.go @@ -31,10 +31,6 @@ func (aw *AlignmentWrapper) UnmarshalTOML(v any) error { type StyleWrapper struct{ tcell.Style } -func NewStyleWrapper(style tcell.Style) StyleWrapper { - return StyleWrapper{Style: style} -} - func (sw *StyleWrapper) UnmarshalTOML(v any) error { m, ok := v.(map[string]any) if !ok { @@ -64,7 +60,6 @@ func (sw *StyleWrapper) UnmarshalTOML(v any) error { sw.parseAttr(s) } } - } case "underline": if s, ok := val.(string); ok { @@ -176,14 +171,14 @@ func (vw *ScrollBarVisibilityWrapper) UnmarshalTOML(val any) error { return nil } -type HelpTheme struct { - ShortKeyStyle StyleWrapper `toml:"short_key_style"` - ShortDescStyle StyleWrapper `toml:"short_desc_style"` - FullKeyStyle StyleWrapper `toml:"full_key_style"` - FullDescStyle StyleWrapper `toml:"full_desc_style"` -} - type ( + HelpTheme struct { + ShortKeyStyle StyleWrapper `toml:"short_key_style"` + ShortDescStyle StyleWrapper `toml:"short_desc_style"` + FullKeyStyle StyleWrapper `toml:"full_key_style"` + FullDescStyle StyleWrapper `toml:"full_desc_style"` + } + ThemeStyle struct { NormalStyle StyleWrapper `toml:"normal_style"` ActiveStyle StyleWrapper `toml:"active_style"` diff --git a/internal/ui/chat/mentions_list.go b/internal/ui/chat/mentions_list.go index 59c0e04..e4ecf5b 100644 --- a/internal/ui/chat/mentions_list.go +++ b/internal/ui/chat/mentions_list.go @@ -39,7 +39,7 @@ func (m *mentionsList) append(item mentionsListItem) { func (m *mentionsList) clear() { m.items = nil - m.List.Clear() + m.Clear() } func (m *mentionsList) rebuild() { diff --git a/internal/ui/chat/message_input.go b/internal/ui/chat/message_input.go index 6dc5b27..38a45fb 100644 --- a/internal/ui/chat/message_input.go +++ b/internal/ui/chat/message_input.go @@ -496,7 +496,7 @@ func (ul userList) Len() int { return len(ul) } -// channelHasUser checks if a user has permission to view the specified channel +// channelHasUser checks if a user has permission to view the specified channel. func channelHasUser(state *ningen.State, channelID discord.ChannelID, userID discord.UserID) bool { perms, err := state.Permissions(channelID, userID) if err != nil { @@ -622,7 +622,6 @@ func (mi *messageInput) addMentionUser(user *discord.User) { }) } -// used by chatView func (mi *messageInput) removeMentionsList() { mi.chatView.HideLayer(mentionsListLayerName) } diff --git a/internal/ui/chat/messages_list.go b/internal/ui/chat/messages_list.go index aff5579..9a8682d 100644 --- a/internal/ui/chat/messages_list.go +++ b/internal/ui/chat/messages_list.go @@ -774,7 +774,7 @@ func unescapeMarkdownEscapes(s string) string { var b strings.Builder b.Grow(len(s)) - for i := 0; i < len(s); i++ { + for i := range len(s) { if s[i] == '\\' && i+1 < len(s) && isMarkdownEscapable(s[i+1]) { continue } diff --git a/internal/ui/chat/view.go b/internal/ui/chat/view.go index 4d6620c..0d9c8ba 100644 --- a/internal/ui/chat/view.go +++ b/internal/ui/chat/view.go @@ -418,7 +418,7 @@ func (v *View) updateFooter() { switch len(names) { case 1: - footer = fmt.Sprintf("%s is typing...", names[0]) + footer = names[0] + " is typing..." case 2: footer = fmt.Sprintf("%s and %s are typing...", names[0], names[1]) case 3: