use-deadlock-detector 435 B

123456789101112131415
  1. #!/usr/bin/env bash
  2. if [[ ! -z $(git status --short --untracked-files=no) ]]; then
  3. echo "Detected uncommitted changes - commit before running this"
  4. exit 1
  5. fi
  6. echo "Installing deadlock detector - use 'git reset --hard HEAD' to undo"
  7. go get -v github.com/sasha-s/go-deadlock/...
  8. find . -type f -name "*.go" -print0 | xargs -0 sed -i~ 's/sync.RWMutex/deadlock.RWMutex/; s/sync.Mutex/deadlock.Mutex/;'
  9. goimports -w .
  10. echo "Done"