A Go library for formatting numbers as money values with customizable currency symbols, precision, and separators.
Accounting is a Go library for formatting numbers as money values with customizable currency symbols, precision, and thousand/decimal separators. It solves the problem of displaying financial data correctly across different locales and numeric types, avoiding floating-point precision issues common in monetary calculations.
Go developers building financial applications, e-commerce systems, or any software that requires locale-aware currency display and precise monetary formatting.
Developers choose Accounting for its comprehensive support of numeric types (including big.Rat and big.Float), built-in locale data for 181 currencies, and performance-optimized type-specific functions, all in a lightweight, dependency-free package.
money and currency formatting for golang
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows complete customization of currency symbols, separators, and format strings for positive, negative, and zero values, as shown with examples like GBP formatting using %s %v.
Works with int, float64, big.Rat, big.Float, and decimal.Decimal via reflection or type-specific functions, enabling precise financial calculations without floating-point errors.
Includes a LocaleInfo map with pre-configured settings for 181 currencies, simplifying internationalization without manual configuration for common formats.
Offers type-specific formatting functions like FormatMoneyInt that avoid runtime reflection, providing faster execution for known data types as highlighted in the README.
The default FormatMoney uses runtime reflection to handle multiple types, which can impact performance in high-throughput scenarios compared to dedicated type-specific methods.
For optimal use with decimal types like decimal.Decimal or apd.Decimal, it requires third-party packages such as shopspring/decimal, adding external dependencies to the project.
Focused solely on formatting and unformatting numbers, lacking built-in features for currency conversion, mathematical operations, or other advanced financial tools, as admitted in the documentation.