Merge pull request 'chore: Go 1.26 modernization' (#2) from chore/go-1.26-modernization into main
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Successful in 1m12s

This commit is contained in:
Charon 2026-02-24 18:01:45 +00:00
commit 134415404d
4 changed files with 10 additions and 8 deletions

View file

@ -2,6 +2,7 @@
package agentci
import (
"errors"
"fmt"
"forge.lthn.ai/core/go/pkg/config"
@ -125,7 +126,7 @@ func SaveAgent(cfg *config.Config, name string, ac AgentConfig) error {
func RemoveAgent(cfg *config.Config, name string) error {
var agents map[string]AgentConfig
if err := cfg.Get("agentci.agents", &agents); err != nil {
return fmt.Errorf("no agents configured")
return errors.New("no agents configured")
}
if _, ok := agents[name]; !ok {
return fmt.Errorf("agent %q not found", name)

View file

@ -306,7 +306,7 @@ func syncPushUpstream(localPath, defaultBranch string) error {
cmd := exec.Command("git", "-C", localPath, "push", "--force", "forge", refspec)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("%s", strings.TrimSpace(string(output)))
return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err)
}
return nil
@ -316,7 +316,7 @@ func syncGitFetch(localPath, remote string) error {
cmd := exec.Command("git", "-C", localPath, "fetch", remote)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("%s", strings.TrimSpace(string(output)))
return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err)
}
return nil
}

View file

@ -321,7 +321,7 @@ func pushUpstream(localPath, defaultBranch string) error {
cmd := exec.Command("git", "-C", localPath, "push", "--force", "gitea", refspec)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("%s", strings.TrimSpace(string(output)))
return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err)
}
return nil
@ -332,7 +332,7 @@ func gitFetch(localPath, remote string) error {
cmd := exec.Command("git", "-C", localPath, "fetch", remote)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("%s", strings.TrimSpace(string(output)))
return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err)
}
return nil
}

View file

@ -2,6 +2,7 @@ package jobrunner
import (
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
@ -52,7 +53,7 @@ type Journal struct {
// NewJournal creates a new Journal rooted at baseDir.
func NewJournal(baseDir string) (*Journal, error) {
if baseDir == "" {
return nil, fmt.Errorf("journal base directory is required")
return nil, errors.New("journal base directory is required")
}
return &Journal{baseDir: baseDir}, nil
}
@ -90,10 +91,10 @@ func sanitizePathComponent(name string) (string, error) {
// Append writes a journal entry for the given signal and result.
func (j *Journal) Append(signal *PipelineSignal, result *ActionResult) error {
if signal == nil {
return fmt.Errorf("signal is required")
return errors.New("signal is required")
}
if result == nil {
return fmt.Errorf("result is required")
return errors.New("result is required")
}
entry := JournalEntry{