fix: improve feature completeness and correctness

Pass 1 (Feature & Completeness):
- Replace apt CLI with apt-get for listUpgrades (apt CLI is unstable for scripting)
- Verify snapd daemon is running in snap Available() check
- Add ErrDaemonNotRunning sentinel error for daemon-dependent managers
- Fix staticcheck S1011: replace loop with append(keys, matches...)
- Fix staticcheck SA1012: use context.TODO() instead of nil in dpkg tests
This commit is contained in:
2026-02-26 01:26:51 +00:00
parent d4c7a058fb
commit 6edb79df3f
6 changed files with 45 additions and 32 deletions

View File

@@ -13,8 +13,12 @@ import (
)
func available() bool {
_, err := exec.LookPath("snap")
return err == nil
if _, err := exec.LookPath("snap"); err != nil {
return false
}
// Verify snapd is running by checking snap version (requires daemon).
cmd := exec.Command("snap", "version")
return cmd.Run() == nil
}
func run(ctx context.Context, args []string) (string, error) {