* Fix fmt

This commit is contained in:
lxowalle 2026-02-27 03:31:09 +08:00
parent 2b9e74007f
commit cadf39c9ef
7 changed files with 33 additions and 23 deletions

View file

@ -137,7 +137,9 @@ func (t *CronTool) addJob(args map[string]any) *common.ToolResult {
t.mu.RUnlock()
if channel == "" || chatID == "" {
return common.ErrorResult("no session context (channel/chat_id not set). Use this tool in an active conversation.")
return common.ErrorResult(
"no session context (channel/chat_id not set). Use this tool in an active conversation.",
)
}
message, ok := args["message"].(string)

View file

@ -85,7 +85,9 @@ func (t *I2CTool) scan(args map[string]any) *common.ToolResult {
devPath := fmt.Sprintf("/dev/i2c-%s", bus)
fd, err := syscall.Open(devPath, syscall.O_RDWR, 0)
if err != nil {
return common.ErrorResult(fmt.Sprintf("failed to open %s: %v (check permissions and i2c-dev module)", devPath, err))
return common.ErrorResult(
fmt.Sprintf("failed to open %s: %v (check permissions and i2c-dev module)", devPath, err),
)
}
defer syscall.Close(fd)

View file

@ -40,7 +40,9 @@ type spiTransfer struct {
func configureSPI(devPath string, mode uint8, bits uint8, speed uint32) (int, *common.ToolResult) {
fd, err := syscall.Open(devPath, syscall.O_RDWR, 0)
if err != nil {
return -1, common.ErrorResult(fmt.Sprintf("failed to open %s: %v (check permissions and spidev module)", devPath, err))
return -1, common.ErrorResult(
fmt.Sprintf("failed to open %s: %v (check permissions and spidev module)", devPath, err),
)
}
// Set SPI mode

View file

@ -4,14 +4,16 @@ import (
"github.com/sipeed/picoclaw/pkg/tools/common"
)
type Tool = common.Tool
type ToolResult = common.ToolResult
type ContextualTool = common.ContextualTool
type AsyncTool = common.AsyncTool
type AsyncCallback = common.AsyncCallback
type FileSystem = common.FileSystem
type HostFs = common.HostFs
type SandboxFs = common.SandboxFs
type (
Tool = common.Tool
ToolResult = common.ToolResult
ContextualTool = common.ContextualTool
AsyncTool = common.AsyncTool
AsyncCallback = common.AsyncCallback
FileSystem = common.FileSystem
HostFs = common.HostFs
SandboxFs = common.SandboxFs
)
func NewToolResult(forLLM string) *ToolResult {
return common.NewToolResult(forLLM)

View file

@ -3,12 +3,13 @@ package web_fetch
import (
"context"
"encoding/json"
"github.com/sipeed/picoclaw/pkg/tools/common"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/sipeed/picoclaw/pkg/tools/common"
)
// TestWebTool_WebFetch_Success verifies successful URL fetching

View file

@ -3,15 +3,16 @@ package write_file
import (
"context"
"io"
"github.com/sipeed/picoclaw/pkg/tools/list_dir"
"github.com/sipeed/picoclaw/pkg/tools/read_file"
"github.com/sipeed/picoclaw/pkg/tools/common"
"os"
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/sipeed/picoclaw/pkg/tools/common"
"github.com/sipeed/picoclaw/pkg/tools/list_dir"
"github.com/sipeed/picoclaw/pkg/tools/read_file"
)
// TestFilesystemTool_ReadFile_Success verifies successful file reading