chore: replace interface{} with any (Go 1.18+ alias)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
674e3c3c9a
commit
09c25b9975
3 changed files with 11 additions and 11 deletions
4
pkg/cache/cache.go
vendored
4
pkg/cache/cache.go
vendored
|
|
@ -67,7 +67,7 @@ func (c *Cache) Path(key string) string {
|
|||
}
|
||||
|
||||
// Get retrieves a cached item if it exists and hasn't expired.
|
||||
func (c *Cache) Get(key string, dest interface{}) (bool, error) {
|
||||
func (c *Cache) Get(key string, dest any) (bool, error) {
|
||||
path := c.Path(key)
|
||||
|
||||
dataStr, err := c.medium.Read(path)
|
||||
|
|
@ -98,7 +98,7 @@ func (c *Cache) Get(key string, dest interface{}) (bool, error) {
|
|||
}
|
||||
|
||||
// Set stores an item in the cache.
|
||||
func (c *Cache) Set(key string, data interface{}) error {
|
||||
func (c *Cache) Set(key string, data any) error {
|
||||
path := c.Path(key)
|
||||
|
||||
// Ensure parent directory exists
|
||||
|
|
|
|||
|
|
@ -44,15 +44,15 @@ type Option func(*Core) error
|
|||
// Message is the interface for all messages that can be sent through the Core's IPC system.
|
||||
// Any struct can be a message, allowing for structured data to be passed between services.
|
||||
// Used with ACTION for fire-and-forget broadcasts.
|
||||
type Message interface{}
|
||||
type Message any
|
||||
|
||||
// Query is the interface for read-only requests that return data.
|
||||
// Used with QUERY (first responder) or QUERYALL (all responders).
|
||||
type Query interface{}
|
||||
type Query any
|
||||
|
||||
// Task is the interface for requests that perform side effects.
|
||||
// Used with PERFORM (first responder executes).
|
||||
type Task interface{}
|
||||
type Task any
|
||||
|
||||
// TaskWithID is an optional interface for tasks that need to know their assigned ID.
|
||||
// This is useful for tasks that want to report progress back to the frontend.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ type contentBlock struct {
|
|||
Text string `json:"text,omitempty"`
|
||||
Input json.RawMessage `json:"input,omitempty"`
|
||||
ToolUseID string `json:"tool_use_id,omitempty"`
|
||||
Content interface{} `json:"content,omitempty"`
|
||||
Content any `json:"content,omitempty"`
|
||||
IsError *bool `json:"is_error,omitempty"`
|
||||
}
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ func extractToolInput(toolName string, raw json.RawMessage) string {
|
|||
}
|
||||
|
||||
// Fallback: show raw JSON keys
|
||||
var m map[string]interface{}
|
||||
var m map[string]any
|
||||
if json.Unmarshal(raw, &m) == nil {
|
||||
var parts []string
|
||||
for k := range m {
|
||||
|
|
@ -353,21 +353,21 @@ func extractToolInput(toolName string, raw json.RawMessage) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func extractResultContent(content interface{}) string {
|
||||
func extractResultContent(content any) string {
|
||||
switch v := content.(type) {
|
||||
case string:
|
||||
return v
|
||||
case []interface{}:
|
||||
case []any:
|
||||
var parts []string
|
||||
for _, item := range v {
|
||||
if m, ok := item.(map[string]interface{}); ok {
|
||||
if m, ok := item.(map[string]any); ok {
|
||||
if text, ok := m["text"].(string); ok {
|
||||
parts = append(parts, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings.Join(parts, "\n")
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
if text, ok := v["text"].(string); ok {
|
||||
return text
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue