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 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

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.

@golang golang locked and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants