Skip to content

Commit

Permalink
fix: make disableEager not trigger the race detector
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik committed Jul 12, 2022
1 parent 023aee7 commit ed5da98
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,13 @@ func (c *Connection) Q() *Query {

// disableEager disables eager mode for current connection.
func (c *Connection) disableEager() {
c.eager = false
c.eagerFields = []string{}
// The check technically is not required, because (*Connection).Eager() creates a (shallow) copy.
// When not reusing eager connections, this should be safe.
// However, this write triggers the go race detector.
if c.eager {
c.eager = false
c.eagerFields = []string{}
}
}

// TruncateAll truncates all data from the datasource
Expand Down

0 comments on commit ed5da98

Please sign in to comment.