Skip to content

feat(helpers/counter): add new thread-safe counter package#7

Merged
madflojo merged 3 commits intomainfrom
counter
Aug 30, 2025
Merged

feat(helpers/counter): add new thread-safe counter package#7
madflojo merged 3 commits intomainfrom
counter

Conversation

@madflojo
Copy link
Copy Markdown
Owner

This pull request introduces a new test-focused, thread-safe counter package (helpers/counter) to the repository, along with supporting configuration, documentation, and build system updates. The counter package is designed to help coordinate asynchronous tests and provides atomic operations and wait helpers. Additional changes ensure that the new module is properly integrated into CI, release, and build workflows.

New package addition:

  • Added the new helpers/counter package, including implementation (counter.go), tests (counter_test.go), usage examples (counter_example_test.go), Makefile, and go.mod. The package provides atomic increment/decrement, direct value manipulation, and wait helpers for test coordination. [1] [2] [3] [4] [5]

Documentation updates:

  • Updated README.md and testlazy.go to document the new counter package, including usage examples and a description in the package table. [1] [2] [3]

Release and build system integration:

  • Updated release configuration files (.release-please-config.json, .release-please-manifest.json) to include helpers/counter for versioning and changelog generation, and added the module to the build/test/lint targets in the root Makefile. [1] [2] [3]

Continuous integration and dependency management:

  • Added helpers/counter to Dependabot configuration for automated dependency updates and to GitHub Actions workflow for Go 1.24 compatibility and coverage reporting. [1] [2]

Formatting improvements:

  • Enhanced formatting steps in the root and module-level Makefiles to use golines for line wrapping if available, improving code readability. [1] [2]

Upgraded to Go 1.24 because it's always sunny in Golang-ville. Added a check before uploading coverage—let's not send empty files to the party!
Introduces a simple, atomic counter suited for testing scenarios with concurrency in mind.
Copilot AI review requested due to automatic review settings August 28, 2025 03:00

This comment was marked as outdated.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5b2e4c5) to head (fd054eb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #7   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         2    +1     
  Lines           52       102   +50     
=========================================
+ Hits            52       102   +50     
Flag Coverage Δ
${ matrix.module }-unittests ?
./helpers/counter-unittests 100.00% <100.00%> (?)
./things/testurl-unittests 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Updated the README to feature a more concise counter example and deleted the redundant counter README. Less is more, even for Go!
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new thread-safe counter package (helpers/counter) designed for test coordination and asynchronous operations, while also improving code formatting across the repository.

  • Adds a complete helpers/counter package with atomic operations and wait helpers for test synchronization
  • Integrates the new package into build, release, and CI workflows
  • Enhances code formatting by adding golines support for improved line wrapping

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
helpers/counter/counter.go Core implementation of thread-safe counter with atomic operations and wait helpers
helpers/counter/counter_test.go Comprehensive test suite covering all counter functionality and timeout scenarios
helpers/counter/counter_example_test.go Example tests demonstrating counter usage patterns
helpers/counter/go.mod Go module definition for the counter package
helpers/counter/Makefile Build, test, and format targets for the counter package
README.md Documentation updates showcasing the new counter package with usage examples
testlazy.go Minor formatting fix changing header style
Makefile Integration of counter package into root build system and golines formatting
.release-please-config.json Release configuration for the new counter package
.release-please-manifest.json Version manifest updates for counter package
.github/workflows/tests.yml CI updates for Go 1.24 compatibility and coverage reporting
.github/dependabot.yml Dependency management configuration for counter package
things/testurl/url_test.go Code formatting improvements using golines
things/testurl/Makefile Added golines formatting support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@madflojo madflojo merged commit 45cc9c1 into main Aug 30, 2025
12 checks passed
@madflojo madflojo deleted the counter branch August 30, 2025 01:40
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.

3 participants