Skip to content

Commit ea50b5f

Browse files
committed
addressing comments for not writing docstring for funcs with unexported types
1 parent bf84b2f commit ea50b5f

File tree

7 files changed

+12
-40
lines changed

7 files changed

+12
-40
lines changed

balancer/endpointsharding/endpointsharding.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,13 @@ func (bw *balancerWrapper) UpdateState(state balancer.State) {
285285
bw.es.updateState()
286286
}
287287

288-
// ParseConfig parses a child config list and returns a LB config for the
289-
// gracefulswitch Balancer.
288+
// ParseConfig parses a child config list and returns a LB to use with the
289+
// endpointsharding balancer.
290+
//
291+
// cfg is expected to be a json.RawMessage containing a JSON array of LB policy
292+
// names + configs as the format of the "loadBalancingConfig" field in
293+
// ServiceConfig. It returns a type that should be passed to
294+
// UpdateClientConnState in the BalancerConfig field.
290295
func ParseConfig(cfg json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
291296
return gracefulswitch.ParseConfig(cfg)
292297
}

credentials/tls/certprovider/pemfile/builder.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ func init() {
4040

4141
type pluginBuilder struct{}
4242

43-
// ParseConfig parses the configuration data from JSON and returns a
44-
// certprovider.BuildableConfig for the PEM file watcher.
4543
func (p *pluginBuilder) ParseConfig(c any) (*certprovider.BuildableConfig, error) {
4644
data, ok := c.(json.RawMessage)
4745
if !ok {
@@ -56,7 +54,6 @@ func (p *pluginBuilder) ParseConfig(c any) (*certprovider.BuildableConfig, error
5654
}), nil
5755
}
5856

59-
// Name returns the name of the PEM file watcher plugin.
6057
func (p *pluginBuilder) Name() string {
6158
return PluginName
6259
}

internal/channelz/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func NewServerMetricsForTesting(started, succeeded, failed, timestamp int64) *Se
5959
return sm
6060
}
6161

62-
// CopyFrom copies the metrics data from provided ServerMetrics
62+
// CopyFrom copies the metrics data from the provided ServerMetrics
6363
// instance into the current instance.
6464
func (sm *ServerMetrics) CopyFrom(o *ServerMetrics) {
6565
sm.CallsStarted.Store(o.CallsStarted.Load())

internal/channelz/socket.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,12 @@ type EphemeralSocketMetrics struct {
7070
RemoteFlowControlWindow int64
7171
}
7272

73-
// SocketType represents the type of socket, indicating whether it is a
74-
// NormalSocket or a ListenSocket.
73+
// SocketType represents the type of socket.
7574
type SocketType string
7675

76+
// SocketType can be one of these.
7777
const (
78-
// SocketTypeNormal represents a standard socket used for normal
79-
// operations.
8078
SocketTypeNormal = "NormalSocket"
81-
82-
// SocketTypeListen represents a socket used specifically for
83-
// listening for incoming connections.
8479
SocketTypeListen = "ListenSocket"
8580
)
8681

internal/testutils/stats/test_metrics_recorder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,5 +290,5 @@ func (r *NoopMetricsRecorder) RecordInt64Histo(*estats.Int64HistoHandle, int64,
290290
// RecordFloat64Histo is noop implementation of RecordFloat64Histo.
291291
func (r *NoopMetricsRecorder) RecordFloat64Histo(*estats.Float64HistoHandle, float64, ...string) {}
292292

293-
// RecordInt64Gauge is moop implementation of RecordInt64Gauge.
293+
// RecordInt64Gauge is noop implementation of RecordInt64Gauge.
294294
func (r *NoopMetricsRecorder) RecordInt64Gauge(*estats.Int64GaugeHandle, int64, ...string) {}

internal/transport/transport.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,6 @@ type recvBufferReader struct {
133133
err error
134134
}
135135

136-
// ReadHeader reads data into the provided header slice. It first checks if
137-
// there is an existing error and returns it immediately if present. If
138-
// there is data remaining from the previous call, it uses `mem.ReadUnsafe`
139-
// to copy the data into the header slice and returns the number of bytes read.
140-
// If there is no previous data, it determines whether to call
141-
// `readHeaderClient` or `readHeader` based on the presence of `closeStream`.
142-
// The method returns the number of bytes read and any error encountered during
143-
// the operation.
144136
func (r *recvBufferReader) ReadHeader(header []byte) (n int, err error) {
145137
if r.err != nil {
146138
return 0, r.err

mem/buffers.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,20 @@ func Copy(data []byte, pool BufferPool) Buffer {
122122
return NewBuffer(buf, pool)
123123
}
124124

125-
// ReadOnlyData returns the underlying byte slice of the Buffer.
126125
func (b *buffer) ReadOnlyData() []byte {
127126
if b.refs == nil {
128127
panic("Cannot read freed buffer")
129128
}
130129
return b.data
131130
}
132131

133-
// Ref increments the reference counter of the Buffer, indicating that an
134-
// additional reference to the Buffer has been acquired.
135132
func (b *buffer) Ref() {
136133
if b.refs == nil {
137134
panic("Cannot ref freed buffer")
138135
}
139136
b.refs.Add(1)
140137
}
141138

142-
// Free decrements the reference counter of the Buffer and releases the
143-
// underlying byte slice if the counter reaches 0.
144139
func (b *buffer) Free() {
145140
if b.refs == nil {
146141
panic("Cannot free freed buffer")
@@ -166,7 +161,6 @@ func (b *buffer) Free() {
166161
}
167162
}
168163

169-
// Len returns the size of the Buffer.
170164
func (b *buffer) Len() int {
171165
return len(b.ReadOnlyData())
172166
}
@@ -203,8 +197,6 @@ func (b *buffer) read(buf []byte) (int, Buffer) {
203197
return n, b
204198
}
205199

206-
// String returns a string representation of the buffer. May be used for
207-
// debugging purposes.
208200
func (b *buffer) String() string {
209201
return fmt.Sprintf("mem.Buffer(%p, data: %p, length: %d)", b, b.ReadOnlyData(), len(b.ReadOnlyData()))
210202
}
@@ -226,26 +218,17 @@ func SplitUnsafe(buf Buffer, n int) (left, right Buffer) {
226218
// methods are no-op implementations.
227219
type emptyBuffer struct{}
228220

229-
// Noop implementation of ReadOnlyData
230221
func (e emptyBuffer) ReadOnlyData() []byte {
231222
return nil
232223
}
233-
234-
// Ref is noop implementation of Ref.
235-
func (e emptyBuffer) Ref() {}
236-
237-
// Free is noop implementation of Free.
224+
func (e emptyBuffer) Ref() {}
238225
func (e emptyBuffer) Free() {}
239-
240-
// Len is noop implementation of Len.
241226
func (e emptyBuffer) Len() int {
242227
return 0
243228
}
244-
245229
func (e emptyBuffer) split(n int) (left, right Buffer) {
246230
return e, e
247231
}
248-
249232
func (e emptyBuffer) read(buf []byte) (int, Buffer) {
250233
return 0, e
251234
}

0 commit comments

Comments
 (0)