-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't embed mutex in exported struct #21
Conversation
As per section #zero-value-mutexes-are-valid: "For exported types, use a private lock."
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @betamos! LGTM modulo nit.
@@ -382,14 +382,14 @@ snapshot := stats.Snapshot() | |||
|
|||
```go | |||
type Stats struct { | |||
sync.Mutex | |||
mu sync.Mutex | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's remove this line now that the mutex is no longer embedded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -382,14 +382,14 @@ snapshot := stats.Snapshot() | |||
|
|||
```go | |||
type Stats struct { | |||
sync.Mutex | |||
mu sync.Mutex | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -361,15 +361,15 @@ state. | |||
|
|||
```go | |||
type Stats struct { | |||
sync.Mutex | |||
mu sync.Mutex | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@betamos Would you mind signing the CLA? Thanks! |
I'm awaiting approval for signing the CLA from the company I work at (sigh). Hopefully resolved in the early week. |
This was a hurdle :(. Essentially me signing the CLA requires a high level approval that I cannot easily get. Perhaps you can accept it the PR without (or I would not mind if you discard it and fix it yourselves instead)? Essentially, a small bug fix or a change like this might not be intellectual property at all, hence a CLA would not be required on your end. But I'm not a lawyer. |
As per section #zero-value-mutexes-are-valid: "For exported types, use a private lock."