Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Exporter option #176

Merged
merged 1 commit into from
Dec 16, 2019
Merged

Add Exporter option #176

merged 1 commit into from
Dec 16, 2019

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Dec 16, 2019

Add an Exporter option that accepts a function to determine
which struct types to permit access to unexported fields.
Treat this as a first-class option and implement AllowUnexported
in terms of the new Exporter option.

The new Exporter option:

  • Better matches the existing style of top-level options
    both by name (e.g., Comparer, Transformer, and Reporter)
    and by API style (all accept a function).
  • Is more flexible as it enables users to functionally
    implement AllowAllUnexported by simply doing:
    Exporter(func(reflect.Type) bool { return true })

Fixes #40

Add an Exporter option that accepts a function to determine
which struct types to permit access to unexported fields.
Treat this as a first-class option and implement AllowUnexported
in terms of the new Exporter option.

The new Exporter option:
* Better matches the existing style of top-level options
both by name (e.g., Comparer, Transformer, and Reporter)
and by API style (all accept a function).
* Is more flexible as it enables users to functionally
implement AllowAllUnexported by simply doing:
	Exporter(func(reflect.Type) bool { return true })
@dsnet dsnet merged commit e1f03df into master Dec 16, 2019
@dsnet dsnet deleted the exporter branch December 16, 2019 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement an AllowAllUnexported Option
2 participants