| # Copyright (c) HashiCorp, Inc. | |
| # SPDX-License-Identifier: MPL-2.0 | |
| rules: | |
| - id: wrong-lock-unlock | |
| patterns: | |
| - pattern-either: | |
| - pattern: | | |
| $M.Lock() | |
| defer $M.RUnlock() | |
| - pattern: | | |
| $M.RLock() | |
| defer $M.Unlock() | |
| - pattern: | | |
| $M.Lock() | |
| defer $M.Lock() | |
| - pattern: | | |
| $M.RLock() | |
| defer $M.RLock() | |
| message: "Wrong lock/unlock pair?" | |
| languages: [go] | |
| severity: ERROR |