A comprehensive utility package for Go that eliminates common boilerplate code with helpers for strings, files, HTTP, errors, and concurrency.
go-dry is a Go utility library that provides a comprehensive collection of helper functions and types to eliminate repetitive boilerplate code in Go applications. It offers utilities for common tasks like string manipulation, file I/O, HTTP handling, error management, concurrency, and encryption, enabling developers to write more concise and consistent code. The library adheres to the DRY (Don't Repeat Yourself) principle, aiming to reduce redundancy and accelerate development.
Go developers working on applications that involve frequent string processing, file operations, web server development, or concurrent data handling, and who seek to minimize boilerplate code. It is particularly useful for backend developers building web services, CLI tools, or systems requiring utilities for JSON/XML marshaling, encryption, and thread-safe operations.
Developers choose go-dry for its extensive, all-in-one set of utilities that cover a wide range of common Go programming patterns, reducing the need to write or import multiple specialized packages. Its unique selling point is the integration of thread-safe types, error collection with ErrorList, and performance optimizations like compression pools, which streamline development while maintaining consistency across projects.
DRY (don't repeat yourself) package for Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers a wide range of helpers for strings, files, HTTP, errors, and more, such as StringFindBetween for text extraction and FileUnmarshallJSON for easy file parsing, reducing repetitive code.
Includes SyncInt, SyncMap, and other wrappers that simplify shared state management in concurrent applications without manual mutex handling, as shown in the thread-safe examples.
Features ErrorList for accumulating multiple errors and PanicIfErr with stack traces, making debugging easier and error handling more organized in complex operations.
Implements compression pools like Gzip.GetWriter for resource reuse, optimizing throughput in data-intensive scenarios like HTTP response handling.
The README explicitly warns that MD5 and SHA1 functions are for non-cryptographic use only, and input validation in utilities like StringToInt may silently fail by returning zero values, hiding errors in production code.
As a monolithic utility package, it can introduce bloat and potential conflicts with other libraries, especially if only a subset of features is needed, increasing project complexity.
Functions that abstract error checking, such as returning zero values on parse errors, might encourage poor practices if developers overlook the warnings, leading to less robust applications.