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
So a wrong error message never fails the test. This is currently masking a real discrepancy: the "set both flags" case passes --i 11 --ai 12 and expects "option i cannot be set along with option ai", but the actual error is "option i cannot be set along with option t". MutuallyExclusiveFlags.check uses f.Names()[0], which returns the primary name (t), not the alias used on the CLI (ai).
Fix: change the assertion to t.Errorf (or assert.Contains(t, err.Error(), test.errStr)) so wrong messages fail, and decide whether the message should reference the flag name as typed on the command line (alias ai) rather than the primary name.
Test coverage gap (related): the regression test added in #2386 (--i --q) only covers "first member of group 0 × second member of group 1". The mirror cases — second member of group 0 (--s --q), and the issue-reproduction layout where the conflicting flag is the second member of both groups — are untested. Recommend adding at least one such case to pin the cross-group fix.
Opened #2409 — the mutually exclusive flag check now reports the name the user actually typed (the alias) instead of the primary name, and the test assertion now uses t.Errorf so a wrong message actually fails.
Activity
chjnett commentedon Aug 16, 2026
Opened #2409 — the mutually exclusive flag check now reports the name the user actually typed (the alias) instead of the primary name, and the test assertion now uses
t.Errorfso a wrong message actually fails.