-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
.*: fix lint issues of not having comments for exported funcs and vars along with any remaining issues and enable remaining disabled rules #7575
Changes from all commits
95776c7
d60462a
25f9a7a
6b6af5b
5bf431b
49ab5e5
7f666f9
08ef901
5a961d9
b7dc304
c65d011
5aefed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -79,13 +79,21 @@ type TraceEvent struct { | |||||||||||
Parent *TraceEvent | ||||||||||||
} | ||||||||||||
|
||||||||||||
// ChannelTrace provides tracing information for a channel. | ||||||||||||
// It tracks various events and metadata related to the channel's lifecycle | ||||||||||||
// and operations. | ||||||||||||
Comment on lines
+82
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
type ChannelTrace struct { | ||||||||||||
cm *channelMap | ||||||||||||
clearCalled bool | ||||||||||||
cm *channelMap | ||||||||||||
clearCalled bool | ||||||||||||
// The time when the trace was created. | ||||||||||||
CreationTime time.Time | ||||||||||||
EventNum int64 | ||||||||||||
mu sync.Mutex | ||||||||||||
Events []*traceEvent | ||||||||||||
// A counter for the number of events recorded in the | ||||||||||||
// trace. | ||||||||||||
EventNum int64 | ||||||||||||
mu sync.Mutex | ||||||||||||
// A slice of traceEvent pointers representing the events recorded for | ||||||||||||
// this channel. | ||||||||||||
Events []*traceEvent | ||||||||||||
Comment on lines
+94
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, should this be unexported? Its type is unexported, which is an anti-pattern. It's probably unused outside this package would be my guess/hope. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its being used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not good. We should export There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not a very descriptive choice, but yes, some other name. Is there any linter that covers unexported types being exposed outside a package, like this case? If so I would like to turn it on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no built-in rule but revive provides framework to write custom rules or we can ask revive contributors for this |
||||||||||||
} | ||||||||||||
|
||||||||||||
func (c *ChannelTrace) copy() *ChannelTrace { | ||||||||||||
|
@@ -175,6 +183,7 @@ var refChannelTypeToString = map[RefChannelType]string{ | |||||||||||
RefNormalSocket: "NormalSocket", | ||||||||||||
} | ||||||||||||
|
||||||||||||
// String returns a string representation of the RefChannelType | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the linter complain for Stringer method not having a comment? This seems unnecessary to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
func (r RefChannelType) String() string { | ||||||||||||
return refChannelTypeToString[r] | ||||||||||||
} | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -182,6 +182,7 @@ func (m *Manager) tryEnterIdleMode() bool { | |||||||
return true | ||||||||
} | ||||||||
|
||||||||
// EnterIdleModeForTesting instructs the channel to enter idle mode. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very optional: Looking at https://pkg.go.dev/google.golang.org/grpc/internal/idle#Manager.EnterIdleModeForTesting, should we add more info from |
||||||||
func (m *Manager) EnterIdleModeForTesting() { | ||||||||
m.tryEnterIdleMode() | ||||||||
} | ||||||||
|
@@ -266,6 +267,7 @@ func (m *Manager) isClosed() bool { | |||||||
return atomic.LoadInt32(&m.closed) == 1 | ||||||||
} | ||||||||
|
||||||||
// Close stops the timer associated with the Manager, if it exists. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we say something like?
Suggested change
Stoping the timer seems like a side effect? |
||||||||
func (m *Manager) Close() { | ||||||||
atomic.StoreInt32(&m.closed, 1) | ||||||||
|
||||||||
|
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.