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

Parse unexported embedded option struct fields in Go 1.6 (consistent w/pre-Go 1.6) #156

Merged
merged 1 commit into from
Dec 22, 2015
Merged

Parse unexported embedded option struct fields in Go 1.6 (consistent w/pre-Go 1.6) #156

merged 1 commit into from
Dec 22, 2015

Conversation

sqs
Copy link
Contributor

@sqs sqs commented Dec 22, 2015

Pre-Go 1.6, the newly added TestEmbeddedUnexported test passes. In Go 1.6beta1, it fails:

$ go test
--- FAIL: TestEmbedded (0.00s)
        assert_test.go:92: Unexpected parse error: unknown flag `v'

This commit makes the behavior consistent across Go versions.

Related: golang/go#12367, specifically the comments about how "code that assumes f.PkgPath != nil means a field is unexported and must be ignored must now be revised to check for f.PkgPath != nil && !f.Anonymous for it to walk into the embedded structs to look for exported fields contained within."

…w/pre-Go 1.6)

Pre-Go 1.6, the newly added TestEmbeddedUnexported test passes. In Go
1.6beta1, it fails:

```
$ go test
--- FAIL: TestEmbedded (0.00s)
        assert_test.go:92: Unexpected parse error: unknown flag `v'
```

This commit makes the behavior consistent across Go versions.

Related: golang/go#12367, specifically the
comments about how "code that assumes `f.PkgPath != nil` means a field
is unexported and must be ignored must now be revised to check for
`f.PkgPath != nil && !f.Anonymous` for it to walk into the embedded
structs to look for exported fields contained within."
jessevdk added a commit that referenced this pull request Dec 22, 2015
Parse unexported embedded option struct fields in Go 1.6 (consistent w/pre-Go 1.6)
@jessevdk jessevdk merged commit d91b7c5 into jessevdk:master Dec 22, 2015
@sqs sqs deleted the go16-embedded-unexported-fields branch December 31, 2015 06:25
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