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

Make lookup support struct tag #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

reyoung
Copy link

@reyoung reyoung commented Aug 16, 2020

Base on PR #6

Comment on lines +83 to +87
// NOTE: Is there any option we need to add?
// Just treat all tag value as the symbol name for now.
if val != name {
continue
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question! To start, I think it would be sufficient to lookup the entire tag value as you do now. In the future, we could allow modifying the tag name as an option to mustache.New().

One use case I can see is reusing the json tag. As that tag may have other values following the comma (e.g omitempty), we may want to split the value and use the first element.

I'd be more than happy to accept it as is though.

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.

2 participants