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

Ignore unnamed literals in structs #416

Merged
merged 1 commit into from Oct 30, 2019

Conversation

jarredhawkins
Copy link
Contributor

@jarredhawkins jarredhawkins commented Oct 29, 2019

@@ -341,7 +341,7 @@ func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor {
if ctx.onlyTaggedField && !hastag && !field.Anonymous() {
continue
}
if tag == "-" {
if tag == "-" || field.Name() == "_" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If needed I can add another flag to ConfigCompatibleWithStandardLibrary to prevent changing the behaviour here for existing clients, which would also allow for them to still have access to these fields.

@codecov
Copy link

codecov bot commented Oct 29, 2019

Codecov Report

Merging #416 into master will decrease coverage by 0.39%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #416     +/-   ##
=========================================
- Coverage   86.88%   86.49%   -0.4%     
=========================================
  Files          41       41             
  Lines        5102     5102             
=========================================
- Hits         4433     4413     -20     
- Misses        533      553     +20     
  Partials      136      136
Impacted Files Coverage Δ
reflect_extension.go 82.98% <100%> (ø) ⬆️
reflect_struct_decoder.go 81.62% <0%> (-2.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03217c3...83f7b82. Read the comment docs.

@taowen taowen merged commit dc11f49 into json-iterator:master Oct 30, 2019
zhenzou pushed a commit to zhenzou/jsoniter that referenced this pull request Feb 2, 2022
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.

None yet

2 participants