Skip to content

Comments

Fix bugs, resource leaks, and test issues in cmd/desync#310

Merged
folbricht merged 1 commit intomasterfrom
fix/cmd-desync-bugs
Feb 14, 2026
Merged

Fix bugs, resource leaks, and test issues in cmd/desync#310
folbricht merged 1 commit intomasterfrom
fix/cmd-desync-bugs

Conversation

@folbricht
Copy link
Owner

Summary

  • store.go: Fix wrong variable in S3 bucket lookup error message — indexStoreFromLocation printed the nil IndexStore variable s instead of the lookup string ls (the equivalent code in storeFromLocation was correct)
  • chunkserver.go, mount-index.go: Fix errors.Wrapf passing err as the format argument instead of opt.storeFile — the error was printed twice while the filename was lost
  • info.go: Fix missing closing quote in unsupported format error string ('%s%q)
  • cat.go, inspectchunks.go: Close output file when writing to disk — os.Create was called but the file was never closed
  • chunkserver.go: Initialize loggingResponseWriter.statusCode to http.StatusOK so handlers that write a body without explicitly calling WriteHeader() log 200 instead of 0
  • config.go: Write config JSON to stdout instead of stderr in read mode
  • prune.go: Check error return from fmt.Fscanln to prevent infinite loop when stdin is closed
  • chunkserver_test.go, indexserver_test.go: Replace require.NoError (calls t.FailNow) with t.Errorf in server goroutines, per project convention (PR Do not call t.Fatal() from non-main goroutines #291)
  • verifyindex_test.go: Remove no-op require.Contains(t, b.String(), "") assertions that always pass

Test plan

  • go build ./cmd/desync succeeds
  • go test ./... passes

- store.go: Fix wrong variable in S3 bucket lookup error message (printed
  nil IndexStore instead of the lookup string)
- chunkserver.go, mount-index.go: Fix errors.Wrapf passing err as format
  arg instead of the store-file path
- info.go: Fix missing closing quote in unsupported format error string
- cat.go, inspectchunks.go: Close output file when writing to disk
- chunkserver.go: Initialize loggingResponseWriter statusCode to 200 so
  implicit WriteHeader is logged correctly
- config.go: Write config JSON to stdout instead of stderr in read mode
- prune.go: Check error from fmt.Fscanln to prevent infinite loop on
  closed stdin
- chunkserver_test.go, indexserver_test.go: Replace require.NoError
  (which calls t.FailNow) with t.Errorf in server goroutines
- verifyindex_test.go: Remove no-op assertions that check for empty string
@folbricht folbricht merged commit 83e2bf2 into master Feb 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant