Skip to content

doc: add thread safety documentation for Error and Append#143

Open
veeceey wants to merge 2 commits intohashicorp:mainfrom
veeceey:fix/issue-93-thread-safety-docs
Open

doc: add thread safety documentation for Error and Append#143
veeceey wants to merge 2 commits intohashicorp:mainfrom
veeceey:fix/issue-93-thread-safety-docs

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 13, 2026

Addresses #93.

multierror.Error and Append are not thread-safe, but this wasn't documented anywhere obvious. Ran into this myself and figured it would save others some debugging time.

Changes:

  • Added thread safety notes to the Error type doc comment in multierror.go
  • Added thread safety notes to the Append function doc comment in append.go
  • Added a "Thread Safety" section to the README with examples showing both Group (recommended) and manual sync.Mutex approaches

The WrappedErrors method already had a concurrency note, so this brings the rest of the public API in line with that.

Document that multierror.Error and the Append function are not safe
for concurrent access from multiple goroutines. Add guidance pointing
users to the Group type for concurrent error collection, or to use a
sync.Mutex for manual synchronization.

Closes hashicorp#93
@veeceey veeceey requested a review from a team as a code owner February 13, 2026 08:52
@veeceey
Copy link
Author

veeceey commented Mar 10, 2026

checking back on this — is there anything blocking it from getting reviewed?

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