1
0
mirror of https://github.com/zhashkevych/go-sqlxmock.git synced 2025-06-12 21:47:29 +02:00

adds missing lock around e.fulfilled() in ExpectationsWereMet()

This commit is contained in:
Michael Darwish
2018-12-20 13:00:51 -05:00
parent f7b0b9305b
commit e671f177c0
2 changed files with 55 additions and 1 deletions

View File

@ -166,7 +166,11 @@ func (c *sqlmock) Close() error {
func (c *sqlmock) ExpectationsWereMet() error {
for _, e := range c.expected {
if !e.fulfilled() {
e.Lock()
fulfilled := e.fulfilled()
e.Unlock()
if !fulfilled {
return fmt.Errorf("there is a remaining expectation which was not matched: %s", e)
}