自动查找实现
Some checks failed
Wire Tests / build (1.25.x, macos-latest) (push) Has been cancelled
Wire Tests / build (1.25.x, ubuntu-latest) (push) Has been cancelled
Wire Tests / build (1.25.x, windows-latest) (push) Has been cancelled

但是自动收集到数组是个超级糟糕的需求。糟糕到我认为需要另起炉灶。
This commit is contained in:
des
2026-02-24 20:55:18 +08:00
parent 9c25c9016f
commit a90823eba4
2 changed files with 35 additions and 2 deletions

View File

@@ -329,6 +329,8 @@ func verifyArgsUsed(set *ProviderSet, used []*providerSetSrc) []error {
// buildProviderMap creates the providerMap and srcMap fields for a given
// provider set. The given provider set's providerMap and srcMap fields are
// ignored.
//
// 这里就是查找注入的核心
func buildProviderMap(fset *token.FileSet, hasher typeutil.Hasher, set *ProviderSet) (*typeutil.Map, *typeutil.Map, []error) {
providerMap := new(typeutil.Map)
providerMap.SetHasher(hasher)