diff --git a/internal/channels/telegram/model.go b/internal/channels/telegram/model.go index 6e634b097..d67aa07bf 100644 --- a/internal/channels/telegram/model.go +++ b/internal/channels/telegram/model.go @@ -57,7 +57,7 @@ func parseModelRest(rest string) (model, provider string, global, session, refre } } model = strings.Join(modelParts, " ") - return + return model, provider, global, session, refresh } // extractProviderFlag extracts --provider= or --provider diff --git a/internal/infrastructure/configuration/discovery.go b/internal/infrastructure/configuration/discovery.go index 8ff72a3ba..01b171004 100644 --- a/internal/infrastructure/configuration/discovery.go +++ b/internal/infrastructure/configuration/discovery.go @@ -26,7 +26,7 @@ type fileSet struct { // main returns the daemon-level config file and its format. YAML wins when // both are present; legacy config.toml is the fallback. -func (fs fileSet) main() (path string, yaml bool, ok bool) { +func (fs fileSet) main() (path string, yaml, ok bool) { if fs.mainYAML != "" { return fs.mainYAML, true, true } diff --git a/internal/infrastructure/configuration/loader_test.go b/internal/infrastructure/configuration/loader_test.go index 655f1fb18..b4772d7c7 100644 --- a/internal/infrastructure/configuration/loader_test.go +++ b/internal/infrastructure/configuration/loader_test.go @@ -342,6 +342,7 @@ func TestFinalizeIndexingDefaults(t *testing.T) { }) } } + func TestIdentitiesConfigParsesTwoIdentities(t *testing.T) { cfg, err := loadBytes([]byte(` bot_user = "default-legacy" diff --git a/internal/plugin/pluginextract/github_com-samcharles93-archie-core-internal-plugin.go b/internal/plugin/pluginextract/github_com-samcharles93-archie-core-internal-plugin.go index 9dde7b1c9..5a7ef4cdd 100644 --- a/internal/plugin/pluginextract/github_com-samcharles93-archie-core-internal-plugin.go +++ b/internal/plugin/pluginextract/github_com-samcharles93-archie-core-internal-plugin.go @@ -38,6 +38,7 @@ func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Name() stri } return W.WName() } + func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Version() string { if W.WVersion == nil { return "" diff --git a/internal/secret/secretextract/github_com-samcharles93-archie-core-internal-secret.go b/internal/secret/secretextract/github_com-samcharles93-archie-core-internal-secret.go index 9defcf9ac..2d5f659fc 100644 --- a/internal/secret/secretextract/github_com-samcharles93-archie-core-internal-secret.go +++ b/internal/secret/secretextract/github_com-samcharles93-archie-core-internal-secret.go @@ -41,12 +41,14 @@ func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Name() stri } return W.WName() } + func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Resolve(key string) (string, error) { if W.WResolve == nil { return "", nil } return W.WResolve(key) } + func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Version() string { if W.WVersion == nil { return "" diff --git a/internal/tools/builtin/find.go b/internal/tools/builtin/find.go index 88aa394cd..e5de98bb5 100644 --- a/internal/tools/builtin/find.go +++ b/internal/tools/builtin/find.go @@ -13,6 +13,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "os" "os/exec" @@ -238,7 +239,7 @@ func runFindGoFallback(ctx context.Context, cwd, searchPath string, p FindParams return nil }) - if err != nil && err != ctx.Err() { + if err != nil && !errors.Is(err, ctx.Err()) { return Result{Content: fmt.Sprintf("find error: %v", err), IsError: true}, nil } diff --git a/internal/tools/builtin/grep.go b/internal/tools/builtin/grep.go index 9eeb45b65..1424eb41a 100644 --- a/internal/tools/builtin/grep.go +++ b/internal/tools/builtin/grep.go @@ -13,6 +13,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "os" "os/exec" @@ -211,7 +212,8 @@ func makeGrepExecutor(cwd string, workspaceIndex GrepIndex) Executor { output = stdout.String() } if output == "" && err != nil { - if exitErr, ok := err.(*exec.ExitError); ok && exitErr.ExitCode() == 1 { + exitErr := &exec.ExitError{} + if errors.As(err, &exitErr) { return grepBackendResult(Result{Content: "no matches found"}, searchBackend, clamped), nil } errMsg := stderr.String() @@ -413,7 +415,7 @@ func grepFallback(ctx context.Context, p GrepParams, searchPath, cwd string, tar results = append(results, res...) return nil }) - if err != nil && err != ctx.Err() { + if err != nil && !errors.Is(err, ctx.Err()) { return "", err } } diff --git a/internal/tools/builtin/read_test.go b/internal/tools/builtin/read_test.go index 0f3dd2e61..7cad3e74c 100644 --- a/internal/tools/builtin/read_test.go +++ b/internal/tools/builtin/read_test.go @@ -10,7 +10,7 @@ import ( "testing" ) -func execRead(t *testing.T, cwd string, params string) Result { +func execRead(t *testing.T, cwd, params string) Result { t.Helper() tool := NewReadTool(cwd, nil) res, err := tool.Execute(context.Background(), json.RawMessage(params), nil) diff --git a/internal/tools/builtin/shell.go b/internal/tools/builtin/shell.go index 8eabcf669..bc35002cb 100644 --- a/internal/tools/builtin/shell.go +++ b/internal/tools/builtin/shell.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "os" @@ -192,7 +193,8 @@ func makeShellExecutor(cwd string, mq *MutationQueue) Executor { }, nil } - if exitErr, ok := err.(*exec.ExitError); ok { + exitErr := &exec.ExitError{} + if errors.As(err, &exitErr) { return Result{ Content: fmt.Sprintf("[exit code: %d]\n%s", exitErr.ExitCode(), content), IsError: true, ErrorKind: "command_exit", Truncated: tr.Truncated, ResultBytes: len(output), diff --git a/internal/webui/webui_test.go b/internal/webui/webui_test.go index c6b7ce3b6..6277d35e8 100644 --- a/internal/webui/webui_test.go +++ b/internal/webui/webui_test.go @@ -302,7 +302,7 @@ func TestHandleSSEEventsSinceError(t *testing.T) { ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) defer cancel() - req, err := http.NewRequestWithContext(ctx, "GET", ts.URL+"/events?since=0", nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, ts.URL+"/events?since=0", nil) if err != nil { t.Fatal(err) }