-
Notifications
You must be signed in to change notification settings - Fork 692
chore: enable exposedSyncMutex rule from go-critic #7726
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
base: main
Are you sure you want to change the base?
chore: enable exposedSyncMutex rule from go-critic #7726
Conversation
3af20f8
to
50e4fb7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7726 +/- ##
=======================================
- Coverage 78.4% 78.4% -0.1%
=======================================
Files 184 184
Lines 14648 14656 +8
=======================================
Hits 11496 11496
- Misses 2801 2809 +8
Partials 351 351
🚀 New features to boost your workflow:
|
50e4fb7
to
faa709c
Compare
faa709c
to
08a5d60
Compare
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.
Overall, it's very good, with an experimental version section (for reference only), pending decision.
08a5d60
to
c624511
Compare
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.
Can you please add deperecation entries in the changelog?
bbb6b0b
to
823a26f
Compare
stable modules should have the methods implemented as no-op
3590ed9
to
ecbf459
Compare
Signed-off-by: Matthieu MOREL <[email protected]>
Signed-off-by: Matthieu MOREL <[email protected]>
Co-authored-by: Flc゛ <[email protected]>
Signed-off-by: Matthieu MOREL <[email protected]>
Signed-off-by: Matthieu MOREL <[email protected]>
ecbf459
to
2238e3b
Compare
Please notice https://github.com/open-telemetry/opentelemetry-go/blob/main/CONTRIBUTING.md#how-to-send-pull-requests:
|
// IDGenerator is used for generating a new traceID and spanID. | ||
type IDGenerator 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.
The field needs to be kept as removing an exported field is a breaking change.
The field should be marked as deprecated.
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.
Aren't the lign added between L28 and L47 here to handle deprecation ?
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.
closed int64 // 0 - not closed, 1 - closed | ||
|
||
sync.RWMutex // used to serialize access to samplerConfig.sampler | ||
mu sync.RWMutex // used to serialize access to samplerConfig.sampler |
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.
The field needs to be kept as removing an exported field is a breaking change.
The field should be marked as deprecated.
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.
Aren't the lign added between L98 and L117 here to handle deprecation ?
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.
This only handles deprecation of the "embedded methods".
But after making this field not embedded this would no longer compile:
package main
import "go.opentelemetry.io/contrib/samplers/jaegerremote"
func main() {
s := new(jaegerremote.Sampler)
s.RWMutex.Lock()
}
Thus this is a breaking change from Go perspective.
More: open-telemetry/opentelemetry-go#6274
Deprecate direct usage of mutex objects and introduce methods for locking/unlocking. Mark mutex fields as deprecated for specific samplers and propagators.
Deprecate direct exposure of mutex objects and suggest methods for locking/unlocking.
Added a deprecated mutex field to perOperationSampler struct.
Add a comment indicating ongoing deletion of the perOperationSampler mutex.
Co-authored-by: Robert Pająk <[email protected]>
sync.RWMutex // Deprecated: mutex is internal and shall not be used. | ||
mu sync.RWMutex // used to serialize access to samplerConfig.sampler |
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.
sync.RWMutex // Deprecated: mutex is internal and shall not be used. | |
mu sync.RWMutex // used to serialize access to samplerConfig.sampler | |
sync.RWMutex // Deprecated: mutex is internal and shall not be used. |
sync.Mutex // Deprecated: mutex is internal and shall not be used. | ||
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.
Is there any reason for duplicating the fields?
sync.Mutex // Deprecated: mutex is internal and shall not be used. | |
mu sync.Mutex | |
sync.Mutex // Deprecated: mutex is internal and shall not be used. |
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.
I just wanted to fix exposedSyncMutex... this is a nightmare 😭. Please take it from here. I don’t want to here about this egg or chicken problem!
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.
Cannot you add a //nolint
that this is required for backwards compatibility?
Description
Enable and fixes more rules from go-critic: