Skip to content

feature/add-strings-package#10

Merged
cedricve merged 6 commits into
mainfrom
feature/add-strings-package
Mar 30, 2026
Merged

feature/add-strings-package#10
cedricve merged 6 commits into
mainfrom
feature/add-strings-package

Conversation

@cedricve
Copy link
Copy Markdown
Member

@cedricve cedricve commented Mar 29, 2026

Description

Motivation

We were missing a shared, well-tested set of string utilities, which led to duplicated logic and inconsistent string handling across the codebase. Common operations like case conversion, padding, truncation, and safe stringification were being reimplemented ad‑hoc or avoided altogether.

What this improves

This PR introduces a dedicated ustrings package that centralizes frequently needed string operations and a flexible Stringify helper for predictable, readable output across primitive types, collections, and structs. The utilities are UTF‑8–safe, cover common edge cases, and come with comprehensive tests, making them reliable building blocks for future features.

Additionally, the Docker build is aligned to compile the actual application entry point (main.go), ensuring the container reflects how the project is meant to be built and run.

Overall, this improves consistency, reduces duplication, and makes string handling safer and easier throughout the project.

Add pkg/ustrings implementing various UTF-8-aware string utilities (Capitalize, ToCamelCase/ToSnakeCase/ToKebabCase, PadLeft/PadRight, Truncate, EllipsisMiddle, Reverse, RemoveWhitespace, SplitAndTrim, JoinNonEmpty, DefaultIfEmpty) plus internal helpers (splitWords, padding/boundary logic). Also add stringify.go providing Stringify with Options to format primitives, slices, arrays, maps, structs and pointers (custom base/format/precision and nil representations). Include comprehensive tests for operations and stringify behavior.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 75.51724% with 71 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/ustrings/stringify.go 67.62% 41 Missing and 4 partials ⚠️
pkg/ustrings/operations.go 82.78% 13 Missing and 13 partials ⚠️

📢 Thoughts on this report? Let us know!

@cedricve cedricve merged commit 78fd52f into main Mar 30, 2026
6 checks passed
@cedricve cedricve deleted the feature/add-strings-package branch March 30, 2026 08:37
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