google / google/go-cmp

Add IgnoreFieldsExcept

Open
#66 17 comments 24 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
4.7k
Forks
243
PR merge metrics
No merged PRs in 30d

Description

For larger structs and when the API is potentially evolving it would be handy to have the inverse of `IgnoreFields`, i.e. `cmpopts.FilterFields(typ interface{}, names ...string) cmp.Option`.

And for symmetry I guess there should also be `FilterInterfaces` and `FilterTypes`.

An alternative naming could be `Include…` if this clashes to much with the root packages concept of filters.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.