Skip to content

Commit

Permalink
Fix deadlock after parsing directory with no files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dennwc committed Dec 13, 2022
1 parent 97cf8c4 commit eee72d1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions interp/src.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (interp *Interpreter) importSrc(rPath, importPath string, skipTest bool) (s
interp.mutex.Lock()
gs := interp.scopes[importPath]
if gs == nil {
interp.mutex.Unlock()
// A nil scope means that no even an empty package is created from source.
return "", fmt.Errorf("no Go files in %s", dir)
}
Expand Down

0 comments on commit eee72d1

Please sign in to comment.