Skip to content

fix: do not abort check on ignored fields#88

Merged
tmzane merged 1 commit intogo-simpler:mainfrom
22dm:fix/tag-ignore
Apr 7, 2024
Merged

fix: do not abort check on ignored fields#88
tmzane merged 1 commit intogo-simpler:mainfrom
22dm:fix/tag-ignore

Conversation

@22dm
Copy link
Copy Markdown
Contributor

@22dm 22dm commented Apr 6, 2024

type Nested struct {
	NoTagA string
}

type Foo struct {
	Ignored Nested `json:"-"`
	NoTagB  string
}

Such a structure should report an error because NoTagB lacks the json tag. However, it currently does not, because the misplaced return instead of continue is made in the code, which skips the check of subsequent fields.

@22dm 22dm force-pushed the fix/tag-ignore branch from ac9b925 to 4b97d2c Compare April 6, 2024 19:50
@22dm 22dm closed this Apr 6, 2024
@22dm 22dm force-pushed the fix/tag-ignore branch from 4b97d2c to 4026f8f Compare April 6, 2024 19:59
@22dm 22dm reopened this Apr 6, 2024
@tmzane tmzane self-requested a review April 7, 2024 16:26
@tmzane
Copy link
Copy Markdown
Member

tmzane commented Apr 7, 2024

Good catch, I totally missed that 😅

Copy link
Copy Markdown
Member

@tmzane tmzane left a comment

Choose a reason for hiding this comment

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

LGTM

@tmzane tmzane changed the title fix: the subsequent fields of the ignored field are skipped fix: do not abort check on ignored fields Apr 7, 2024
@tmzane tmzane merged commit d59fd57 into go-simpler:main Apr 7, 2024
@tmzane
Copy link
Copy Markdown
Member

tmzane commented Apr 7, 2024

Thanks!

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