Skip to content

query: skip unexported embedded scalar fields - #194

Open
bensynapse wants to merge 1 commit into
google:masterfrom
bensynapse:fix-private-embedded-fields
Open

bensynapse wants to merge 1 commit into
google:masterfrom
bensynapse:fix-private-embedded-fields

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

Embedding type hidden string in an options struct makes query.Values panic on reflection access to that private field. A nil pointer to the same type adds an unexpected parameter.

The visibility filter now skips private scalar embeds. Promoted public fields of private embedded structs still encode normally.

I added eight cases. Five fail on unchanged master, including four panics. The remaining cases check exported scalar fields and promoted struct fields.

The CI command go test -v -race -coverprofile coverage.txt -covermode atomic ./... passes on Go 1.13.15, 1.23.4 and 1.26.3. Each reports 100% statement coverage. golangci-lint 2.1.2, golint, go build ./... and go vet ./... also pass.

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.

1 participant