Merge origin/dev into feature/errors-batch

Resolved conflicts in io.Medium migration:
- Use coreio.Local.Exists() for existence checks
- Use coreio.Local.DeleteAll() for recursive deletion
- Keep complete MockMedium implementations with proper error handling
- Consolidate client_test.go with both simple and _Good suffix tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-02 06:46:31 +00:00
commit 4b0d89ca7c
3 changed files with 31 additions and 8 deletions

View file

@ -3,20 +3,35 @@ version: '3'
vars:
VERSION:
sh: git describe --tags --exact-match 2>/dev/null || echo "dev"
LDFLAGS: "-X github.com/host-uk/core/pkg/cli.AppVersion={{.VERSION}}"
# Base ldflags for version injection
LDFLAGS_BASE: "-X github.com/host-uk/core/pkg/cli.AppVersion={{.VERSION}}"
# Development build: includes debug info
LDFLAGS: "{{.LDFLAGS_BASE}}"
# Release build: strips debug info and symbol table for smaller binary
LDFLAGS_RELEASE: "-s -w {{.LDFLAGS_BASE}}"
tasks:
# --- CLI Management ---
cli:build:
desc: "Build core CLI to ./bin/core"
desc: "Build core CLI to ./bin/core (dev build with debug info)"
cmds:
- go build -ldflags '{{.LDFLAGS}}' -o ./bin/core .
cli:build:release:
desc: "Build core CLI for release (smaller binary, no debug info)"
cmds:
- go build -ldflags '{{.LDFLAGS_RELEASE}}' -o ./bin/core .
cli:install:
desc: "Install core CLI to system PATH"
desc: "Install core CLI to system PATH (dev build)"
cmds:
- go install -ldflags '{{.LDFLAGS}}' .
cli:install:release:
desc: "Install core CLI for release (smaller binary)"
cmds:
- go install -ldflags '{{.LDFLAGS_RELEASE}}' .
# --- Development ---
test:
desc: "Run all tests"

View file

@ -117,7 +117,7 @@ func runRegistrySetupWithReg(ctx context.Context, reg *repos.Registry, registryP
// Check if already exists
repoPath := filepath.Join(basePath, repo.Name)
// Check .git dir existence via List
// Check .git dir existence via Exists
if coreio.Local.Exists(filepath.Join(repoPath, ".git")) {
exists++
continue

View file

@ -99,13 +99,19 @@ func (s *State) Add(c *Container) error {
return s.SaveState()
}
// Get retrieves a container by ID.
// Get retrieves a copy of a container by ID.
// Returns a copy to prevent data races when the container is modified.
func (s *State) Get(id string) (*Container, bool) {
s.mu.RLock()
defer s.mu.RUnlock()
c, ok := s.Containers[id]
return c, ok
if !ok {
return nil, false
}
// Return a copy to prevent data races
copy := *c
return &copy, true
}
// Update updates a container in the state and persists it.
@ -126,14 +132,16 @@ func (s *State) Remove(id string) error {
return s.SaveState()
}
// All returns all containers in the state.
// All returns copies of all containers in the state.
// Returns copies to prevent data races when containers are modified.
func (s *State) All() []*Container {
s.mu.RLock()
defer s.mu.RUnlock()
containers := make([]*Container, 0, len(s.Containers))
for _, c := range s.Containers {
containers = append(containers, c)
copy := *c
containers = append(containers, &copy)
}
return containers
}