ScuttleBot
fix: gofmt and govet — format three files, check resp error before use
Commit
336984bb60f6490aa319cba2e1738b18036e62d60ccab076d931d6fe65084ea4
Parent
c61f88f4bbd59f7…
5 files changed
+1
-1
+4
-4
+4
-1
+5
-5
+6
-2
+1
-1
| --- docs/guide/adding-agents.md | ||
| +++ docs/guide/adding-agents.md | ||
| @@ -283,11 +283,11 @@ | ||
| 283 | 283 | |
| 284 | 284 | Each runtime stores its session data in a different location: |
| 285 | 285 | |
| 286 | 286 | | Runtime | Session log location | |
| 287 | 287 | |---------|---------------------| |
| 288 | -| Claude Code | Claude projects directory — JSONL files named by session UUID | | |
| 288 | +| Claude Code | `~/.claude/projects/{cwd-hash}/` — JSONL files named by session UUID | | |
| 289 | 289 | | Codex | `~/.codex/sessions/{session-id}.jsonl` | |
| 290 | 290 | | Gemini CLI | `~/.gemini/sessions/{session-id}.jsonl` | |
| 291 | 291 | |
| 292 | 292 | To find the latest session file: |
| 293 | 293 | |
| 294 | 294 |
| --- docs/guide/adding-agents.md | |
| +++ docs/guide/adding-agents.md | |
| @@ -283,11 +283,11 @@ | |
| 283 | |
| 284 | Each runtime stores its session data in a different location: |
| 285 | |
| 286 | | Runtime | Session log location | |
| 287 | |---------|---------------------| |
| 288 | | Claude Code | Claude projects directory — JSONL files named by session UUID | |
| 289 | | Codex | `~/.codex/sessions/{session-id}.jsonl` | |
| 290 | | Gemini CLI | `~/.gemini/sessions/{session-id}.jsonl` | |
| 291 | |
| 292 | To find the latest session file: |
| 293 | |
| 294 |
| --- docs/guide/adding-agents.md | |
| +++ docs/guide/adding-agents.md | |
| @@ -283,11 +283,11 @@ | |
| 283 | |
| 284 | Each runtime stores its session data in a different location: |
| 285 | |
| 286 | | Runtime | Session log location | |
| 287 | |---------|---------------------| |
| 288 | | Claude Code | `~/.claude/projects/{cwd-hash}/` — JSONL files named by session UUID | |
| 289 | | Codex | `~/.codex/sessions/{session-id}.jsonl` | |
| 290 | | Gemini CLI | `~/.gemini/sessions/{session-id}.jsonl` | |
| 291 | |
| 292 | To find the latest session file: |
| 293 | |
| 294 |
| --- internal/api/channels_topology.go | ||
| +++ internal/api/channels_topology.go | ||
| @@ -22,14 +22,14 @@ | ||
| 22 | 22 | Voice []string `json:"voice,omitempty"` |
| 23 | 23 | Autojoin []string `json:"autojoin,omitempty"` |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | type provisionChannelResponse struct { |
| 27 | - Channel string `json:"channel"` | |
| 28 | - Type string `json:"type,omitempty"` | |
| 29 | - Supervision string `json:"supervision,omitempty"` | |
| 30 | - Autojoin []string `json:"autojoin,omitempty"` | |
| 27 | + Channel string `json:"channel"` | |
| 28 | + Type string `json:"type,omitempty"` | |
| 29 | + Supervision string `json:"supervision,omitempty"` | |
| 30 | + Autojoin []string `json:"autojoin,omitempty"` | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // handleProvisionChannel handles POST /v1/channels. |
| 34 | 34 | // It provisions an IRC channel via ChanServ, applies the autojoin policy for |
| 35 | 35 | // the channel's type, and returns the channel name, type, and supervision channel. |
| 36 | 36 |
| --- internal/api/channels_topology.go | |
| +++ internal/api/channels_topology.go | |
| @@ -22,14 +22,14 @@ | |
| 22 | Voice []string `json:"voice,omitempty"` |
| 23 | Autojoin []string `json:"autojoin,omitempty"` |
| 24 | } |
| 25 | |
| 26 | type provisionChannelResponse struct { |
| 27 | Channel string `json:"channel"` |
| 28 | Type string `json:"type,omitempty"` |
| 29 | Supervision string `json:"supervision,omitempty"` |
| 30 | Autojoin []string `json:"autojoin,omitempty"` |
| 31 | } |
| 32 | |
| 33 | // handleProvisionChannel handles POST /v1/channels. |
| 34 | // It provisions an IRC channel via ChanServ, applies the autojoin policy for |
| 35 | // the channel's type, and returns the channel name, type, and supervision channel. |
| 36 |
| --- internal/api/channels_topology.go | |
| +++ internal/api/channels_topology.go | |
| @@ -22,14 +22,14 @@ | |
| 22 | Voice []string `json:"voice,omitempty"` |
| 23 | Autojoin []string `json:"autojoin,omitempty"` |
| 24 | } |
| 25 | |
| 26 | type provisionChannelResponse struct { |
| 27 | Channel string `json:"channel"` |
| 28 | Type string `json:"type,omitempty"` |
| 29 | Supervision string `json:"supervision,omitempty"` |
| 30 | Autojoin []string `json:"autojoin,omitempty"` |
| 31 | } |
| 32 | |
| 33 | // handleProvisionChannel handles POST /v1/channels. |
| 34 | // It provisions an IRC channel via ChanServ, applies the autojoin policy for |
| 35 | // the channel's type, and returns the channel name, type, and supervision channel. |
| 36 |
| --- internal/api/channels_topology_test.go | ||
| +++ internal/api/channels_topology_test.go | ||
| @@ -97,11 +97,14 @@ | ||
| 97 | 97 | |
| 98 | 98 | body, _ := json.Marshal(map[string]string{"name": "no-hash"}) |
| 99 | 99 | req, _ := http.NewRequest(http.MethodPost, srv.URL+"/v1/channels", bytes.NewReader(body)) |
| 100 | 100 | req.Header.Set("Authorization", "Bearer "+tok) |
| 101 | 101 | req.Header.Set("Content-Type", "application/json") |
| 102 | - resp, _ := http.DefaultClient.Do(req) | |
| 102 | + resp, err := http.DefaultClient.Do(req) | |
| 103 | + if err != nil { | |
| 104 | + t.Fatalf("do: %v", err) | |
| 105 | + } | |
| 103 | 106 | defer resp.Body.Close() |
| 104 | 107 | if resp.StatusCode != http.StatusBadRequest { |
| 105 | 108 | t.Errorf("want 400, got %d", resp.StatusCode) |
| 106 | 109 | } |
| 107 | 110 | } |
| 108 | 111 |
| --- internal/api/channels_topology_test.go | |
| +++ internal/api/channels_topology_test.go | |
| @@ -97,11 +97,14 @@ | |
| 97 | |
| 98 | body, _ := json.Marshal(map[string]string{"name": "no-hash"}) |
| 99 | req, _ := http.NewRequest(http.MethodPost, srv.URL+"/v1/channels", bytes.NewReader(body)) |
| 100 | req.Header.Set("Authorization", "Bearer "+tok) |
| 101 | req.Header.Set("Content-Type", "application/json") |
| 102 | resp, _ := http.DefaultClient.Do(req) |
| 103 | defer resp.Body.Close() |
| 104 | if resp.StatusCode != http.StatusBadRequest { |
| 105 | t.Errorf("want 400, got %d", resp.StatusCode) |
| 106 | } |
| 107 | } |
| 108 |
| --- internal/api/channels_topology_test.go | |
| +++ internal/api/channels_topology_test.go | |
| @@ -97,11 +97,14 @@ | |
| 97 | |
| 98 | body, _ := json.Marshal(map[string]string{"name": "no-hash"}) |
| 99 | req, _ := http.NewRequest(http.MethodPost, srv.URL+"/v1/channels", bytes.NewReader(body)) |
| 100 | req.Header.Set("Authorization", "Bearer "+tok) |
| 101 | req.Header.Set("Content-Type", "application/json") |
| 102 | resp, err := http.DefaultClient.Do(req) |
| 103 | if err != nil { |
| 104 | t.Fatalf("do: %v", err) |
| 105 | } |
| 106 | defer resp.Body.Close() |
| 107 | if resp.StatusCode != http.StatusBadRequest { |
| 108 | t.Errorf("want 400, got %d", resp.StatusCode) |
| 109 | } |
| 110 | } |
| 111 |
| --- internal/api/config_handlers_test.go | ||
| +++ internal/api/config_handlers_test.go | ||
| @@ -146,15 +146,15 @@ | ||
| 146 | 146 | func TestHandlePutConfigLogging(t *testing.T) { |
| 147 | 147 | srv, store := newCfgTestServer(t) |
| 148 | 148 | |
| 149 | 149 | update := map[string]any{ |
| 150 | 150 | "logging": map[string]any{ |
| 151 | - "enabled": true, | |
| 152 | - "dir": "./data/logs", | |
| 153 | - "format": "jsonl", | |
| 154 | - "rotation": "daily", | |
| 155 | - "per_channel": true, | |
| 151 | + "enabled": true, | |
| 152 | + "dir": "./data/logs", | |
| 153 | + "format": "jsonl", | |
| 154 | + "rotation": "daily", | |
| 155 | + "per_channel": true, | |
| 156 | 156 | "max_age_days": 30, |
| 157 | 157 | }, |
| 158 | 158 | } |
| 159 | 159 | body, _ := json.Marshal(update) |
| 160 | 160 | req, _ := http.NewRequest(http.MethodPut, srv.URL+"/v1/config", bytes.NewReader(body)) |
| 161 | 161 |
| --- internal/api/config_handlers_test.go | |
| +++ internal/api/config_handlers_test.go | |
| @@ -146,15 +146,15 @@ | |
| 146 | func TestHandlePutConfigLogging(t *testing.T) { |
| 147 | srv, store := newCfgTestServer(t) |
| 148 | |
| 149 | update := map[string]any{ |
| 150 | "logging": map[string]any{ |
| 151 | "enabled": true, |
| 152 | "dir": "./data/logs", |
| 153 | "format": "jsonl", |
| 154 | "rotation": "daily", |
| 155 | "per_channel": true, |
| 156 | "max_age_days": 30, |
| 157 | }, |
| 158 | } |
| 159 | body, _ := json.Marshal(update) |
| 160 | req, _ := http.NewRequest(http.MethodPut, srv.URL+"/v1/config", bytes.NewReader(body)) |
| 161 |
| --- internal/api/config_handlers_test.go | |
| +++ internal/api/config_handlers_test.go | |
| @@ -146,15 +146,15 @@ | |
| 146 | func TestHandlePutConfigLogging(t *testing.T) { |
| 147 | srv, store := newCfgTestServer(t) |
| 148 | |
| 149 | update := map[string]any{ |
| 150 | "logging": map[string]any{ |
| 151 | "enabled": true, |
| 152 | "dir": "./data/logs", |
| 153 | "format": "jsonl", |
| 154 | "rotation": "daily", |
| 155 | "per_channel": true, |
| 156 | "max_age_days": 30, |
| 157 | }, |
| 158 | } |
| 159 | body, _ := json.Marshal(update) |
| 160 | req, _ := http.NewRequest(http.MethodPut, srv.URL+"/v1/config", bytes.NewReader(body)) |
| 161 |
+6
-2
| --- pkg/client/topology.go | ||
| +++ pkg/client/topology.go | ||
| @@ -99,11 +99,13 @@ | ||
| 99 | 99 | if err != nil { |
| 100 | 100 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %w", err) |
| 101 | 101 | } |
| 102 | 102 | defer resp.Body.Close() |
| 103 | 103 | if resp.StatusCode != http.StatusCreated { |
| 104 | - var apiErr struct{ Error string `json:"error"` } | |
| 104 | + var apiErr struct { | |
| 105 | + Error string `json:"error"` | |
| 106 | + } | |
| 105 | 107 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 106 | 108 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %s", apiErr.Error) |
| 107 | 109 | } |
| 108 | 110 | var info ChannelInfo |
| 109 | 111 | if err := json.NewDecoder(resp.Body).Decode(&info); err != nil { |
| @@ -128,11 +130,13 @@ | ||
| 128 | 130 | if err != nil { |
| 129 | 131 | return fmt.Errorf("topology: drop channel: %w", err) |
| 130 | 132 | } |
| 131 | 133 | defer resp.Body.Close() |
| 132 | 134 | if resp.StatusCode != http.StatusNoContent { |
| 133 | - var apiErr struct{ Error string `json:"error"` } | |
| 135 | + var apiErr struct { | |
| 136 | + Error string `json:"error"` | |
| 137 | + } | |
| 134 | 138 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 135 | 139 | return fmt.Errorf("topology: drop channel: %s", apiErr.Error) |
| 136 | 140 | } |
| 137 | 141 | return nil |
| 138 | 142 | } |
| 139 | 143 |
| --- pkg/client/topology.go | |
| +++ pkg/client/topology.go | |
| @@ -99,11 +99,13 @@ | |
| 99 | if err != nil { |
| 100 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %w", err) |
| 101 | } |
| 102 | defer resp.Body.Close() |
| 103 | if resp.StatusCode != http.StatusCreated { |
| 104 | var apiErr struct{ Error string `json:"error"` } |
| 105 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 106 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %s", apiErr.Error) |
| 107 | } |
| 108 | var info ChannelInfo |
| 109 | if err := json.NewDecoder(resp.Body).Decode(&info); err != nil { |
| @@ -128,11 +130,13 @@ | |
| 128 | if err != nil { |
| 129 | return fmt.Errorf("topology: drop channel: %w", err) |
| 130 | } |
| 131 | defer resp.Body.Close() |
| 132 | if resp.StatusCode != http.StatusNoContent { |
| 133 | var apiErr struct{ Error string `json:"error"` } |
| 134 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 135 | return fmt.Errorf("topology: drop channel: %s", apiErr.Error) |
| 136 | } |
| 137 | return nil |
| 138 | } |
| 139 |
| --- pkg/client/topology.go | |
| +++ pkg/client/topology.go | |
| @@ -99,11 +99,13 @@ | |
| 99 | if err != nil { |
| 100 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %w", err) |
| 101 | } |
| 102 | defer resp.Body.Close() |
| 103 | if resp.StatusCode != http.StatusCreated { |
| 104 | var apiErr struct { |
| 105 | Error string `json:"error"` |
| 106 | } |
| 107 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 108 | return ChannelInfo{}, fmt.Errorf("topology: create channel: %s", apiErr.Error) |
| 109 | } |
| 110 | var info ChannelInfo |
| 111 | if err := json.NewDecoder(resp.Body).Decode(&info); err != nil { |
| @@ -128,11 +130,13 @@ | |
| 130 | if err != nil { |
| 131 | return fmt.Errorf("topology: drop channel: %w", err) |
| 132 | } |
| 133 | defer resp.Body.Close() |
| 134 | if resp.StatusCode != http.StatusNoContent { |
| 135 | var apiErr struct { |
| 136 | Error string `json:"error"` |
| 137 | } |
| 138 | _ = json.NewDecoder(resp.Body).Decode(&apiErr) |
| 139 | return fmt.Errorf("topology: drop channel: %s", apiErr.Error) |
| 140 | } |
| 141 | return nil |
| 142 | } |
| 143 |