Merged
Conversation
Full Go project scaffold with all packages that compile clean and pass golangci-lint. Architecture mirrors the shell script feature set: - cmd/guardian: entry point, signal handling, main loop - internal/config: env var → typed Config (all AUTOHEAL_*/NOTIFY_* vars) - internal/docker: Docker API wrapper (containers, events, inspect) - internal/guardian: core loop, unhealthy restart, dependency recovery, guards - internal/notify: multi-service dispatcher (gotify, discord, slack, etc.) - internal/logging: structured JSON logging via log/slog - internal/metrics: Prometheus endpoint placeholder Uses github.com/moby/moby client library. Requires Go 1.24+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix nil Filters panic (make(client.Filters) instead of zero-value), switch operational logs from slog to fmt.Printf for test-compatible output, add per-cycle caching for orchestration events and backup status, fix URL encoding in sendForm, create multi-stage Go Dockerfile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI now runs: go build, golangci-lint, go test -race before acceptance tests. Unit tests cover event resolution logic, env var parsing, service detection, and event filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
New Go packages
cmd/guardian— entrypoint with signal handling, backward-compatCMD ["autoheal"]arginternal/config— env var loading with same defaults as shell versioninternal/docker— Docker API client (moby SDK), container listing, events, restart/startinternal/guardian— main monitoring loop: unhealthy restart, dependency orphan recovery, orchestration/backup/grace-period guards with per-cycle cachinginternal/notify— 10-service notification dispatcher (gotify, discord, slack, telegram, pushover, pushbullet, lunasea, webhook, apprise, email)internal/logging— slog-based structured loggerinternal/metrics— prometheus stub (placeholder)Key fixes during implementation
client.Filterszero value is nil map — all Docker API calls usemake(client.Filters).Add(...)fmt.Printfto stdout (not slog) for acceptance test grep compatibilitysendForm()usesurl.Values.Encode()instead of raw string concatenationCI
gojob: build, golangci-lint, unit tests (go test -race)Test plan
go build ./cmd/guardiancompiles cleangolangci-lint run ./...passesgo test -count=1 ./...— unit tests pass (config + notify)docker build -t docker-guardian .— image builds (23MB)🤖 Generated with Claude Code