Skip to content

Commit 273a8a2

Browse files
authored
Merge pull request #550 from mymmrac/govet-linter
feat(linter): Fix govet linter
2 parents b3e20c7 + 02b4d9f commit 273a8a2

File tree

17 files changed

+29
-61
lines changed

17 files changed

+29
-61
lines changed

.github/workflows/pr.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,6 @@ jobs:
2424
with:
2525
version: v2.10.1
2626

27-
# TODO: Remove once linter is properly configured
28-
vet:
29-
name: Vet
30-
runs-on: ubuntu-latest
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v6
34-
35-
- name: Setup Go
36-
uses: actions/setup-go@v6
37-
with:
38-
go-version-file: go.mod
39-
40-
- name: Run go generate
41-
run: go generate ./...
42-
43-
- name: Run go vet
44-
run: go vet ./...
45-
4627
test:
4728
name: Tests
4829
runs-on: ubuntu-latest

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ linters:
4747
- godox
4848
- goprintffuncname
4949
- gosec
50-
- govet
5150
- ineffassign
5251
- lll
5352
- maintidx

cmd/picoclaw/cmd_auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func authLoginOpenAI(useDeviceCode bool) {
114114
os.Exit(1)
115115
}
116116

117-
if err := auth.SetCredential("openai", cred); err != nil {
117+
if err = auth.SetCredential("openai", cred); err != nil {
118118
fmt.Printf("Failed to save credentials: %v\n", err)
119119
os.Exit(1)
120120
}
@@ -188,7 +188,7 @@ func authLoginGoogleAntigravity() {
188188
fmt.Printf("Project: %s\n", projectID)
189189
}
190190

191-
if err := auth.SetCredential("google-antigravity", cred); err != nil {
191+
if err = auth.SetCredential("google-antigravity", cred); err != nil {
192192
fmt.Printf("Failed to save credentials: %v\n", err)
193193
os.Exit(1)
194194
}
@@ -265,7 +265,7 @@ func authLoginPasteToken(provider string) {
265265
os.Exit(1)
266266
}
267267

268-
if err := auth.SetCredential(provider, cred); err != nil {
268+
if err = auth.SetCredential(provider, cred); err != nil {
269269
fmt.Printf("Failed to save credentials: %v\n", err)
270270
os.Exit(1)
271271
}

cmd/picoclaw/cmd_gateway.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ func gatewayCmd() {
9898
channel, chatID = "cli", "direct"
9999
}
100100
// Use ProcessHeartbeat - no session history, each heartbeat is independent
101-
response, err := agentLoop.ProcessHeartbeat(context.Background(), prompt, channel, chatID)
101+
var response string
102+
response, err = agentLoop.ProcessHeartbeat(context.Background(), prompt, channel, chatID)
102103
if err != nil {
103104
return tools.ErrorResult(fmt.Sprintf("Heartbeat error: %v", err))
104105
}

cmd/picoclaw/cmd_skills.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ func skillsInstallFromRegistry(cfg *config.Config, registryName, slug string) {
118118
workspace := cfg.WorkspacePath()
119119
targetDir := filepath.Join(workspace, "skills", slug)
120120

121-
if _, err := os.Stat(targetDir); err == nil {
121+
if _, err = os.Stat(targetDir); err == nil {
122122
fmt.Printf("\u2717 Skill '%s' already installed at %s\n", slug, targetDir)
123123
os.Exit(1)
124124
}
125125

126126
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
127127
defer cancel()
128128

129-
if err := os.MkdirAll(filepath.Join(workspace, "skills"), 0o755); err != nil {
129+
if err = os.MkdirAll(filepath.Join(workspace, "skills"), 0o755); err != nil {
130130
fmt.Printf("\u2717 Failed to create skills directory: %v\n", err)
131131
os.Exit(1)
132132
}

pkg/channels/telegram.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
267267

268268
transcribedText := ""
269269
if c.transcriber != nil && c.transcriber.IsAvailable() {
270-
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
270+
transcriberCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
271271
defer cancel()
272272

273-
result, err := c.transcriber.Transcribe(ctx, voicePath)
273+
result, err := c.transcriber.Transcribe(transcriberCtx, voicePath)
274274
if err != nil {
275275
logger.ErrorCF("telegram", "Voice transcription failed", map[string]any{
276276
"error": err.Error(),

pkg/channels/wecom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (c *WeComBotChannel) handleMessageCallback(ctx context.Context, w http.Resp
272272
AgentID string `xml:"AgentID"`
273273
}
274274

275-
if err := xml.Unmarshal(body, &encryptedMsg); err != nil {
275+
if err = xml.Unmarshal(body, &encryptedMsg); err != nil {
276276
logger.ErrorCF("wecom", "Failed to parse XML", map[string]any{
277277
"error": err.Error(),
278278
})

pkg/channels/wecom_app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (c *WeComAppChannel) handleMessageCallback(ctx context.Context, w http.Resp
348348
AgentID string `xml:"AgentID"`
349349
}
350350

351-
if err := xml.Unmarshal(body, &encryptedMsg); err != nil {
351+
if err = xml.Unmarshal(body, &encryptedMsg); err != nil {
352352
logger.ErrorCF("wecom_app", "Failed to parse XML", map[string]any{
353353
"error": err.Error(),
354354
})

pkg/channels/wecom_app_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -852,19 +852,6 @@ func TestWeComAppMessageStructures(t *testing.T) {
852852
}
853853
})
854854

855-
t.Run("WeComImageMessage structure", func(t *testing.T) {
856-
msg := WeComImageMessage{
857-
ToUser: "user123",
858-
MsgType: "image",
859-
AgentID: 1000002,
860-
}
861-
msg.Image.MediaID = "media_123456"
862-
863-
if msg.Image.MediaID != "media_123456" {
864-
t.Errorf("Image.MediaID = %q, want %q", msg.Image.MediaID, "media_123456")
865-
}
866-
})
867-
868855
t.Run("WeComAccessTokenResponse structure", func(t *testing.T) {
869856
jsonData := `{
870857
"errcode": 0,

pkg/channels/wecom_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,8 @@ func TestWeComBotVerifySignature(t *testing.T) {
198198
Token: "",
199199
WebhookURL: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test",
200200
}
201-
base := NewBaseChannel("wecom", cfgEmpty, msgBus, cfgEmpty.AllowFrom)
202201
chEmpty := &WeComBotChannel{
203-
BaseChannel: base,
204-
config: cfgEmpty,
202+
config: cfgEmpty,
205203
}
206204

207205
if !WeComVerifySignature(chEmpty.config.Token, "any_sig", "any_ts", "any_nonce", "any_msg") {

0 commit comments

Comments
 (0)