A Go library for generating random fake data and populating structs with customizable builders and zero dependencies.
Faker is a Go library designed to generate random fake data for testing, prototyping, and development purposes. It provides over 100 built-in generator functions and can automatically populate Go structs with realistic fake values using struct tags. The library solves the problem of creating consistent, customizable test data without manual effort.
Go developers who need to generate test data, mock objects, or factory functions for unit tests, integration tests, or development environments.
Developers choose Faker for its zero dependencies, extensive built-in generators, easy struct population via tags, and the ability to create custom builders for specialized data generation needs.
Random fake data and struct generator 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.
With over 100 functions covering usernames, strings, integers, currency names, and more, it provides a wide range of realistic data types out of the box, reducing manual setup.
The struct builder uses tags like `faker:"username"` to automatically fill fields, supporting pointers, slices, maps, and nested structs with recursive loop detection for complex data models.
As a lightweight library with no external dependencies, it minimizes project bloat and simplifies integration, making it easy to adopt in any Go environment.
Developers can register custom builders to extend or override default behavior, as shown in the D&D class example, enabling domain-specific data generation without modifying core code.
Creating custom builders requires writing Go functions with variadic parameters, which can be overkill for simple data needs and adds development overhead compared to libraries with pre-built niche generators.
The README notes that benchmarks are 'coming soon,' indicating a lack of performance data that might be crucial for teams evaluating efficiency in high-throughput testing scenarios.
While it has many generators, teams needing esoteric or locale-specific data types may find the built-in set insufficient, necessitating custom implementations that can slow down initial setup.