[fix] The directory is not recognized when it is in a soft link (#3337)

master
唐小鸭 1 year ago committed by GitHub
parent f7e701a634
commit bcccfab824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -81,7 +81,12 @@ func getRealModule(workDir string, execRun execx.RunFunc) (*Module, error) {
return nil, err return nil, err
} }
for _, m := range modules { for _, m := range modules {
if strings.HasPrefix(workDir, m.Dir) { mRealDir, err := pathx.ReadLink(m.Dir)
if err != nil {
return nil, fmt.Errorf("mod dir [%s] error: %w", m.Dir, err)
}
if strings.HasPrefix(workDir, mRealDir) {
return &m, nil return &m, nil
} }
} }

Loading…
Cancel
Save