-
Notifications
You must be signed in to change notification settings - Fork 46
Restore mutex Lock/Unlock cuddling support in v5 #218
Copy link
Copy link
Closed
Description
Problem
In wsl v4, allow-cuddle-with-calls defaulted to ["Lock", "RLock"] and allow-cuddle-with-rhs defaulted to ["Unlock", "RUnlock"]. This allowed idiomatic Go mutex patterns without requiring blank lines:
s.mu.Lock()
for _, item := range items {
// critical section
}
s.mu.Unlock()
In v5, this was removed. Now the above code triggers:
missing whitespace above this line (invalid statement above range)
missing whitespace above this line (invalid statement above expr)
Why This Matters
Mutex Lock/Unlock and the protected code form a logical unit. Adding blank lines separates things that belong together and can actually harm readability. This is a universal Go pattern used extensively in the standard library and major projects.
Proposal
Add a configuration option to restore mutex-aware cuddling in v5, for example:
wsl_v5:
allow-mutex-cuddle: true # default: true
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels