Add WithTransformerFunc helper and improve docs discoverability#45
Merged
Add WithTransformerFunc helper and improve docs discoverability#45
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a convenience helper WithTransformerFunc to reduce verbosity when registering inline transformers, and significantly improves documentation discoverability through strategic anchor additions and navigation tables.
Changes:
- Adds
Loader.WithTransformerFunc(fn func(context.Context, *T) error)as an ergonomic wrapper around the verboseWithTransformer(TransformerFunc[T](fn))syntax - Updates transformer examples in README.md and examples/transformer/main.go to use the new concise syntax
- Enhances documentation navigation with deep-linkable anchors in quick-start.md and configuration-sources.md, plus comprehensive navigation tables in README.md
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| loader.go | Adds WithTransformerFunc convenience method that delegates to WithTransformer |
| loader_test.go | Adds comprehensive unit test verifying chaining, registration, and execution of the wrapped transformer |
| examples/transformer/main.go | Updates example to use the new WithTransformerFunc helper instead of verbose WithTransformer(TransformerFunc[...]) syntax |
| docs/api-reference.md | Documents the new helper with example usage and recommends it for inline transforms |
| docs/quick-start.md | Adds HTML anchors for deep-linking and standardizes heading capitalization |
| docs/configuration-sources.md | Adds HTML anchors for improved documentation navigation |
| README.md | Updates transformer example to use new helper and adds comprehensive navigation tables linking to documentation sections with new anchors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Azhovan
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add an ergonomic inline transformer registration helper and improve discoverability of related configuration features in the docs/examples.
This PR:
Loader.WithTransformerFunc(fn func(context.Context, *T) error)as a convenience wrapper overWithTransformer(TransformerFunc[T](fn))loader_test.goWithTransformerFunc(...)and preferred inline usage indocs/api-reference.mdREADME.mdandexamples/transformer/main.goto use the shorter syntaxWhy
Inline typed transformers are a common use case, and the current syntax is verbose at call sites:
WithTransformer(rigging.TransformerFunc[T](func(...) ...))The helper keeps the existing transformer API and semantics intact while making the common inline case easier to read and copy from docs/examples.
The docs changes make features like transforms, snapshots, watch/reload, and key-mapping semantics easier to discover from the README and quick-start pages.
Type
Testing
Executed:
gofmt -w loader.go loader_test.go gofmt -w examples/transformer/main.go go test ./...Result:
go test ./...passed (including compile checks forexamples/basicandexamples/transformer)Would run:
Reason:
Checklist
go test ./...)gofmt -s -w .)go vet ./...)Notes:
gofmt -w(not repo-widegofmt -s -w .)For reviewers: Does this align with Rigging's philosophy of simplicity and zero dependencies?