Multiple methods write to os.Stdout instead of v.Stdout, breaking testability #26

zavřený
otevřeno 2026-02-08 21:01:08 +01:00 uživatelem clawbot · 0 komentářů
Spolupracovník

Bug

Several methods in the vaultik package write directly to os.Stdout instead of using the injectable v.Stdout writer. This breaks the TestVaultik testing infrastructure which captures output via buffers.

Affected methods:

  • ListSnapshots - uses tabwriter.NewWriter(os.Stdout, ...) and json.NewEncoder(os.Stdout)
  • PurgeSnapshots - uses fmt.Println, fmt.Printf, fmt.Scanln
  • VerifySnapshotWithOptions - uses fmt.Printf directly
  • outputPruneBlobsJSON - package-level function uses os.Stdout
  • outputRemoveJSON - uses json.NewEncoder(os.Stdout)
  • ShowInfo - uses fmt.Printf throughout

Impact

  • Output cannot be captured in tests
  • Output cannot be redirected programmatically
  • Inconsistent behavior: some methods use v.Stdout, others bypass it

Fix

Replace all os.Stdout references with v.Stdout and fmt.Printf/fmt.Println with fmt.Fprintf(v.Stdout, ...).

## Bug Several methods in the `vaultik` package write directly to `os.Stdout` instead of using the injectable `v.Stdout` writer. This breaks the `TestVaultik` testing infrastructure which captures output via buffers. Affected methods: - `ListSnapshots` - uses `tabwriter.NewWriter(os.Stdout, ...)` and `json.NewEncoder(os.Stdout)` - `PurgeSnapshots` - uses `fmt.Println`, `fmt.Printf`, `fmt.Scanln` - `VerifySnapshotWithOptions` - uses `fmt.Printf` directly - `outputPruneBlobsJSON` - package-level function uses `os.Stdout` - `outputRemoveJSON` - uses `json.NewEncoder(os.Stdout)` - `ShowInfo` - uses `fmt.Printf` throughout ## Impact - Output cannot be captured in tests - Output cannot be redirected programmatically - Inconsistent behavior: some methods use `v.Stdout`, others bypass it ## Fix Replace all `os.Stdout` references with `v.Stdout` and `fmt.Printf`/`fmt.Println` with `fmt.Fprintf(v.Stdout, ...)`.
clawbot přiřadil/a sobě toto 2026-02-08 21:01:08 +01:00
clawbot přidal/a needs-rebase štítek 2026-02-20 09:17:44 +01:00
sneak uzavřel/a tento úkol 2026-02-20 11:07:53 +01:00
Přihlaste se pro zapojení do konverzace.
1 účastníků
Oznámení
Termín dokončení
Žádný termín dokončení.
Závislosti

Nejsou nastaveny žádné závislosti.

Reference: sneak/vaultik#26