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

Effective go book: log.Logger must be replaced with job.Logger #39810

Closed
yifu opened this issue Jun 24, 2020 · 1 comment
Closed

Effective go book: log.Logger must be replaced with job.Logger #39810

yifu opened this issue Jun 24, 2020 · 1 comment

Comments

@yifu
Copy link

@yifu yifu commented Jun 24, 2020

I am reading the Effective go book. I thing I found a typo. In the following paragraph:

Embedding types introduces the problem of name conflicts but the rules to resolve them are simple. First, a field or method X hides any other item X in a more deeply nested part of the type. If log.Logger contained a field or method called Command, the Command field of Job would dominate it.

log.Logger must be replaced with job.Logger, I guess.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 25, 2020

Thanks, but the text is correct as written. It's saying that when you embed log.Logger in job.Logger, the fields of job.Logger hide the fields of log.Logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.