Add golang program with integer add function #16
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add golang program with integer add function
Summary
This PR adds a new golang program that implements integer addition functionality with both a library API and command-line interface. The implementation includes:
Add(a, b int) intfunction for adding two integersAddMultiple(numbers ...int) intfunction for adding multiple integersAdditionally, this PR fixes a CI issue by updating the deprecated
actions/upload-artifact@v2tov4in the GitHub Actions workflow.Review & Testing Checklist for Human
go run cmd/add/main.go 5 10,go run cmd/add/main.go 1 2 3 4 5,go run cmd/add/main.go -5 10go run cmd/add/main.go abc 123andgo run cmd/add/main.go 5(insufficient args)Test Plan: Navigate to
cmd/add/directory and rungo test -vto verify all tests pass, then test the CLI with various integer combinations to ensure proper functionality.Diagram
%%{ init : { "theme" : "default" }}%% graph TD A["cmd/add/main.go<br/>New CLI program"]:::major-edit B["cmd/add/add_test.go<br/>Unit tests"]:::major-edit C["cmd/add/go.mod<br/>Module definition"]:::major-edit D["cmd/add/go.sum<br/>Dependencies"]:::major-edit E["cmd/add/README.md<br/>Documentation"]:::major-edit F[".github/workflows/main.yml<br/>CI workflow"]:::minor-edit G["omil repository<br/>Root project"]:::context A --> B A --> C C --> D G --> A G --> F subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes