style: format code with gofmt

This commit is contained in:
yuchou87
2026-02-19 18:53:24 +08:00
parent e38364b08a
commit 47533a00cd
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -161,8 +161,8 @@ func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers
contextBuilder: contextBuilder,
tools: toolsRegistry,
mcpManager: mcpManager,
mcpConfig: cfg.Tools.MCP, // Store only MCP config (minimal dependency)
workspacePath: workspace, // Store workspace path for envFile resolution
mcpConfig: cfg.Tools.MCP, // Store only MCP config (minimal dependency)
workspacePath: workspace, // Store workspace path for envFile resolution
subagentManager: subagentManager,
summarizing: sync.Map{},
}
+7 -7
View File
@@ -134,32 +134,32 @@ func TestEnvFilePriority(t *testing.T) {
// Create a temporary .env file
tmpDir := t.TempDir()
envFile := filepath.Join(tmpDir, ".env")
envContent := `API_KEY=from_file
DATABASE_URL=from_file
SHARED_VAR=from_file`
if err := os.WriteFile(envFile, []byte(envContent), 0644); err != nil {
t.Fatalf("Failed to create .env file: %v", err)
}
// Load envFile
envVars, err := loadEnvFile(envFile)
if err != nil {
t.Fatalf("Failed to load env file: %v", err)
}
// Verify envFile variables
if envVars["API_KEY"] != "from_file" {
t.Errorf("Expected API_KEY=from_file, got %s", envVars["API_KEY"])
}
// Simulate config.Env overriding envFile
configEnv := map[string]string{
"SHARED_VAR": "from_config",
"NEW_VAR": "from_config",
}
// Merge: envFile first, then config overrides
merged := make(map[string]string)
for k, v := range envVars {
@@ -168,7 +168,7 @@ SHARED_VAR=from_file`
for k, v := range configEnv {
merged[k] = v
}
// Verify priority: config.Env should override envFile
if merged["SHARED_VAR"] != "from_config" {
t.Errorf("Expected SHARED_VAR=from_config (config should override file), got %s", merged["SHARED_VAR"])
+2 -2
View File
@@ -39,9 +39,9 @@ func TestNewMCPTool(t *testing.T) {
"type": "string",
"description": "Test input",
},
},
},
}
},
}
mcpTool := NewMCPTool(manager, "test_server", tool)