awalterschulze/goderive

Derives and generates mundane golang functions that you do not want to maintain yourself

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 48 minutes ago
Added to GitGenius on August 3rd, 2026
Created on February 10th, 2017
Open Issues & Pull Requests: 19 (+0)
GitHub issues: Enabled
Number of forks: 45
Total Stargazers: 1,261 (+0)
Total Subscribers: 16 (+0)

Issue Activity (beta)

Open issues: 2
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 837 days
Stale 30+ days: 2
Stale 90+ days: 2

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • effort-low (1)
  • skill-level-beginner (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Repository Insights (GitGenius)

Median issue/PR response: 2.1 days
Mean response time: 368.5 days
90th percentile: 1102.3 days
Tracked items: 3

Most active contributors

Detailed Description

goderive is a code generation tool for Go that automatically derives and generates boilerplate functions developers would otherwise need to write and maintain manually. The tool works by parsing Go source code to identify unimplemented functions with specific prefixes, then generates their implementations based on the input parameter types. When types are modified, goderive can regenerate these functions to keep them synchronized with the latest changes, solving the common problem of developers forgetting to update derived functions after adding fields to structs.

The repository provides an extensive collection of derivable functions organized into several categories. Recursive functions include Equal for comparing values, Compare for ordering, DeepCopy for duplicating data structures, Clone for creating copies, GoString for string representation, and Hash for computing hash values. Set-related functions encompass Keys for extracting map keys, Sort for ordering slices, Unique for removing duplicates, Set for converting slices to maps, Min and Max for finding extremes, Contains for membership testing, and Intersect and Union for set operations. Functional programming functions include Fmap for mapping operations, Join for flattening nested structures, Flip for argument reordering, Curry and Uncurry for function transformation, Tuple for creating tuple functions, Compose for function composition, Mem for memoization, Traverse for sequential operations, ToError for error conversion, and Apply for partial application. Concurrency-focused functions support channel operations including Fmap over channels, Join for channel flattening, Pipeline for channel composition, Do for concurrent operations, and Dup for channel duplication.

The tool uses a straightforward naming convention where functions are prefixed with derive followed by the function name in camel case, such as deriveEqual. Developers can derive multiple variants for different types by appending type-specific suffixes, allowing deriveEqualMyStruct and deriveEqualMySecondStruct to coexist. The command-line interface supports customizable function prefixes through flags, and features like autoname and dedup can automatically manage function naming to ensure uniqueness and prevent duplicate generation.

Installation is simple through go install, and goderive integrates seamlessly with Go's build ecosystem. It can be invoked directly from the command line using standard Go path semantics like goderive ./..., or integrated into build processes via go generate directives. The repository includes examples demonstrating various use cases and configuration approaches, from basic usage to custom prefix setups.

Several functions are marked as deprecated in favor of Go's native generics support, reflecting the tool's evolution as the language has matured. This indicates active maintenance and adaptation to modern Go practices. The tool addresses a genuine pain point in Go development where many common operations require repetitive, type-specific implementations that are tedious to maintain across evolving codebases.

goderive
by
awalterschulzeawalterschulze/goderive

Repository Details

Fetching additional details & charts...