dogmatiq / dogmatiq/testkit

Audit append calls that use shared/caller-supplied slices.

Open
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
1
Forks
1
Avg merge
2m
Merged PRs (30d)
1

Description

This is about auditing the entire code base to ensure that no caller-supplied slices are being appended to.

This was a common source of bugs from me when I first started developing in Go. It is problematic because the caller may supply a slice that refers to a sub-section of an array that they are still using in full. If we append to that sub-slice it clobbers elements in the underlying array.

The solution is to first duplicate caller-supplied slices if we need to append. It's possible that there are no such occurrences in this repo.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the entire Go codebase for append calls involving caller-supplied slices, then inspect each occurrence for possible aliasing with the caller's underlying array. The audit is done when all such occurrences are addressed or confirmed safe, with the test suite passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.