You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add testing/synctest compatibility for go-deadlock
Support testing/synctest:
- DisableTimerPool option to make sure times stay within the bubble
- channel-based mutex/rwmutex for
* fmt
* Fix synctest compatibility
- ChannelMutex/ChannelRWMutex for synctest compatibility
- Fixes timer pool handling: uses non-blocking drain to avoid deadlocks
in synctest bubbles
- Support Go 1.25 native synctest tests
Fixes: #42
Manually tested with: dunglas/mercure#1099
* Add GODEBUG=asynctimerchan=0 to CI for Go 1.25 synctest compatibility
* Add build tag system with synctest compatibility and disable mode
+ sync_disable.go for zero-overhead mode (-tags=deadlock_disable)
+ synctest compatibility mode (-tags=goexperiment.synctest)
+ buildtag_test.go and scripts/test-buildtags.sh
***Disabled mode** (`-tags=deadlock_disable`): Zero overhead, no detection
184
+
185
+
**Why synctest mode?**`sync.Mutex` is not durably blocking in synctest bubbles, but channels are. Synctest mode uses channel-based mutexes to ensure proper behavior with `testing/synctest`.
186
+
187
+
### Quick Examples
188
+
189
+
```bash
190
+
# Normal development/testing
191
+
go test ./...
192
+
193
+
# Testing with synctest (Go 1.25+, recommended)
194
+
GODEBUG=asynctimerchan=0 go test -tags=deadlock_synctest ./...
195
+
196
+
# Testing with experimental synctest
197
+
GODEBUG=asynctimerchan=0 go test -tags=goexperiment.synctest ./...
198
+
199
+
# Production build with zero overhead
200
+
go build -tags=deadlock_disable ./...
201
+
```
202
+
175
203
## Configuring go-deadlock
176
204
177
205
Have a look at [Opts](https://pkg.go.dev/github.com/sasha-s/go-deadlock#pkg-variables).
0 commit comments