Your Cond() has a side-effect. It can never be optimized away.
Re:The Use of assert() in SQLite
by kasey_junk on Saturday April 27, 2019 @07:19PM
(#19768243)
Correct. Which is one of the differences between this approach & macros. Though the lazy approach appears to work.
https://play.golang.org/p/Ts6QqRrWwuQ
I couldn't get that to not trigger the lock.
[later] I could get it to remove it if you pass in a func instead.