Skip to content

Commit eee72d1

Browse files
authored
Fix deadlock after parsing directory with no files
Currently if interpreter tries to eval an empty directory with no Go files it will error (as it should), but all future calls to eval will deadlock, because the mutex is not unlocked correctly. I believe this is a critical issue that must be addressed.
1 parent 97cf8c4 commit eee72d1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

interp/src.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ func (interp *Interpreter) importSrc(rPath, importPath string, skipTest bool) (s
133133
interp.mutex.Lock()
134134
gs := interp.scopes[importPath]
135135
if gs == nil {
136+
interp.mutex.Unlock()
136137
// A nil scope means that no even an empty package is created from source.
137138
return "", fmt.Errorf("no Go files in %s", dir)
138139
}

0 commit comments

Comments
 (0)