Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. goverter

goverter

MITGov1.9.4

Generate type-safe Go converters by defining interface function signatures, avoiding runtime reflection.

Visit WebsiteGitHubGitHub
848 stars63 forks0 contributors

What is goverter?

Goverter is a Go code generator that creates type-safe converters between different data structures. It allows developers to define conversion rules through simple interface declarations, then automatically generates efficient conversion code without relying on runtime reflection.

Target Audience

Go developers who need to convert between complex data types, such as when mapping API request/response models, database entities to domain objects, or between different package structures.

Value Proposition

Developers choose Goverter over reflection-based alternatives because it generates explicit, type-safe conversion code at compile time, ensuring better performance and catching conversion errors early during code generation rather than at runtime.

Overview

Generate type-safe Go converters by defining function signatures.

Use Cases

Best For

  • Generating type-safe converters between API request and response models in Go web services.
  • Mapping database entity structs to domain model structs without using runtime reflection.
  • Converting between similar but differently named structs across different packages or modules.
  • Handling complex nested structures with configurable deep or shallow copy behavior.
  • Automating conversion of slices, maps, and enums between types with custom mapping rules.
  • Ensuring compile-time safety for data transformations in large Go codebases.

Not Ideal For

  • Projects requiring dynamic, runtime conversion of data with unknown or frequently changing structures.
  • Teams preferring reflection-based libraries for quick, one-off mappings without code generation overhead.
  • Applications where the data structures are so dissimilar that manual mapping logic would dominate, negating automation benefits.

Pros & Cons

Pros

Runtime Performance

Generates explicit conversion code that avoids reflection at runtime, leading to faster execution compared to reflection-based alternatives, as emphasized in the 'Fast execution' feature.

Compile-Time Safety

Catches errors early during code generation, such as unmapped fields or unsafe type conversions, preventing runtime failures and enhancing reliability.

Flexible Customization

Allows implementation of custom converter methods for complex logic, enabling handling of edge cases beyond automatic mapping, as documented in the extend section.

Comprehensive Type Support

Handles slices, maps, named types, primitives, pointers, and structs with matching fields, covering a wide range of Go data structures seamlessly.

Cons

Code Generation Overhead

Requires running the goverter CLI to regenerate converters whenever source or target types change, adding a step to the development workflow that can be cumbersome in fast-evolving codebases.

Static Interface Limitation

Conversions must be predefined in interfaces, making it unsuitable for dynamic scenarios where data structures are not known at compile time or require ad-hoc transformations.

Annotation-Based Configuration

Relies on Go comments (e.g., //goverter:map) for configuration, which can be less intuitive and more error-prone than using struct tags or other standard Go patterns.

Frequently Asked Questions

Quick Stats

Stars848
Forks63
Contributors0
Open Issues18
Last commit1 month ago
CreatedSince 2021

Tags

#generator#developer-tools#copy#converter#type-safety#struct-mapping#golang#go-tools#go#code-generation#data-conversion#performance

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 5 hours ago

Related Projects

oapi-codegenoapi-codegen

Generate Go client and server boilerplate from OpenAPI 3 specifications

Stars8,283
Forks1,031
Last commit1 day ago
go-linqgo-linq

.NET LINQ capabilities in Go

Stars3,651
Forks224
Last commit5 months ago
jenniferjennifer

Jennifer is a code generator for Go

Stars3,614
Forks162
Last commit1 year ago
GoWrapGoWrap

GoWrap is a command line tool for generating decorators for Go interfaces

Stars1,322
Forks93
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub