Repository navigation
v1.0.17
🐛 Bug Fixes
-
Fix bare function/type calls inside closures not intercepting unexported cross-package symbols
When the extractor lifts a closure from its original package into the generation target package, it prefixes bare identifier calls with the package qualifier. If the original package contains an unexported function (e.g.buildAuditAuthorizer), lifting produces an illegalpkg.buildAuditAuthorizercross-package reference. Becausedigendoes not compile the generated output, it silently exited 0 and emitted uncompilable code.Fix:
- Added
checkFunctionVisibilityInClosure: before generation, walks all bare identifier calls (fn(args)/T(x)) in the closure body and usescheckGenerationVisibilityto reject unexported cross-package symbols (same-package, exported, and builtin symbols are allowed), producing a clearprivateerror and no broken file - Extended
checkGenerationVisibility's switch with a*types.TypeNamecase to also cover unexported cross-package types in type conversionsT(x) - Added regression example
example/gen_failures/closure_private_fn/
- Added
-
Fix parameter shadowing in
example/db/db.goRedisClient.Ping
Ping(index RedisDbIndex)used the package-level variableIndexinstead of theindexparameter in itsfmt.Printf, making the parameter effectively unused. Now correctly references theindexparameter. -
Fix duplicate-binding error message for default Supply
When two default (unnamed)dig.Supplycalls provide the same type, the error message incorrectly showedwith name ""instead of(default). Root cause: in the unnamed casekeyNamed == keyDefault, so the named-key check matched first. Refactored intoif instanceName != "" { ... } else { ... }branches so the default-instance error correctly shows(default).
♻️ Refactor and Optimisation
- Generator config and sample adjustment
Regenerated all exampledig_gen.gofiles with the unifieddvvariable prefix, inline inlining enabled by default, and debug logging removed from generated code. - unused_provider example reworked
example/gen_failures/unused_providernow registers its provider via thedig.Provide+dig.Supplypattern.
📦 Examples and Documentation Updates
- New success examples
example/app_runtime_err(runtime error-propagation paths: panic for provider errors, propagation for invoke errors) andexample/app_xpkg_generic(cross-package genericcache.Cache[*common.Config]where both the generic type and the type argument come from different packages). - New failure examples
Underexample/gen_failures/addedambiguous,duplicate_named,duplicate_supply,private_visibility,unused_provider, covering named-instance ambiguity, duplicate named binding, duplicate default Supply, cross-package unexported visibility, and unused provider error paths. - GitHub Pages site
Addeddocs/static site (project intro, core features, quick start, API overview, comparison matrix, examples, version timeline) plus a.nojekyllfile. - GitHub Pages bilingual toggle
Added 中文/EN language switching (localStorage persistence, synced title/meta, code blocks stay language-neutral). - System prompts & industrial coding-skill docs updated
Trimmed and synced the files underprompts/.
🔧 Chores
- Bumped version references in README / CHANGELOG / system prompts to v1.0.17.