Skip to content

Commit

Permalink
fix(wire): imports mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
Just-maple committed Dec 1, 2023
1 parent a37ac55 commit 794fa9e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/plugins/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,9 @@ func (w Wire) parseInterfaceMethods(name string, dir string, imports zcore.Impor

func (w Wire) generateSet(dir string, sets map[string]*wireDeclSet) (err error) {
var (
dstImports = zcore.Imports{"github.com/google/wire": "wire"}
dstImportPath = zcore.GetImportPath(dir)
dstImports = zcore.Imports{"github.com/google/wire": "wire"}
dstImportPath = zcore.GetImportPath(dir)
dstImportsMutex sync.Mutex

aopImportsMutex sync.Mutex
aopImports = make(zcore.Imports)
Expand All @@ -436,6 +437,8 @@ func (w Wire) generateSet(dir string, sets map[string]*wireDeclSet) (err error)

// fix name import package selector
fp := func(name string) string {
dstImportsMutex.Lock()
defer dstImportsMutex.Unlock()
return zcore.FixPackage(name, el.Path, dstImportPath, srcImports, dstImports)
}

Expand Down

0 comments on commit 794fa9e

Please sign in to comment.