From ee491360027c3746b3db58ea1adb6d8273067db1 Mon Sep 17 00:00:00 2001 From: linhaolin1 Date: Thu, 2 Apr 2026 18:51:29 +0800 Subject: [PATCH] fix: resolve linting issues in VK channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Format VKConfig struct tags to comply with golines - Remove unused mu sync.Mutex field - Remove unused stripPrefix method All tests passing ✓ --- pkg/channels/vk/vk.go | 11 ----------- pkg/config/config.go | 12 ++++++------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/pkg/channels/vk/vk.go b/pkg/channels/vk/vk.go index 37900dbf5..0bc373d18 100644 --- a/pkg/channels/vk/vk.go +++ b/pkg/channels/vk/vk.go @@ -5,7 +5,6 @@ import ( "fmt" "strconv" "strings" - "sync" "github.com/SevereCloud/vksdk/v3/api" "github.com/SevereCloud/vksdk/v3/api/params" @@ -27,7 +26,6 @@ type VKChannel struct { config *config.Config ctx context.Context cancel context.CancelFunc - mu sync.Mutex } func NewVKChannel(cfg *config.Config, bus *bus.MessageBus) (*VKChannel, error) { @@ -244,15 +242,6 @@ func (c *VKChannel) stripBotMention(text string) string { return strings.TrimSpace(text) } -func (c *VKChannel) stripPrefix(text string, prefixes []string) string { - for _, prefix := range prefixes { - if strings.HasPrefix(text, prefix) { - return strings.TrimSpace(strings.TrimPrefix(text, prefix)) - } - } - return text -} - func (c *VKChannel) getUserName(userID int) string { users, err := c.vk.UsersGet(api.Params{ "user_ids": userID, diff --git a/pkg/config/config.go b/pkg/config/config.go index 5f9842779..e169cb91e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -549,14 +549,14 @@ type IRCConfig struct { } type VKConfig struct { - Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"` - Token SecureString `json:"token,omitzero" yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_VK_TOKEN"` - GroupID int `json:"group_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_GROUP_ID"` - AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"` + Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"` + Token SecureString `json:"token,omitzero" yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_VK_TOKEN"` + GroupID int `json:"group_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_GROUP_ID"` + AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"` GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty" yaml:"-"` - Typing TypingConfig `json:"typing,omitempty" yaml:"-"` + Typing TypingConfig `json:"typing,omitempty" yaml:"-"` Placeholder PlaceholderConfig `json:"placeholder,omitempty" yaml:"-"` - ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_REASONING_CHANNEL_ID"` + ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_REASONING_CHANNEL_ID"` } func (c *VKConfig) SetToken(token string) {