mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 09:50:00 +08:00
fix: go work duplicate prefix get err (#4487)
This commit is contained in:
@@ -82,13 +82,15 @@ func getRealModule(workDir string, execRun execx.RunFunc) (*Module, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if workDir[len(workDir)-1] != os.PathSeparator {
|
||||
workDir = workDir + string(os.PathSeparator)
|
||||
}
|
||||
for _, m := range modules {
|
||||
realDir, err := pathx.ReadLink(m.Dir)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read go.mod, dir: %s, error: %w", m.Dir, err)
|
||||
}
|
||||
|
||||
realDir += string(os.PathSeparator)
|
||||
if strings.HasPrefix(workDir, realDir) {
|
||||
return &m, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user