Skip to content

Commit 5cad14e

Browse files
authored
Apply suggestions from code review
1 parent 0338de0 commit 5cad14e

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

internal/conn/conn.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ func (c *conn) setState(ctx context.Context, s State) State {
158158
return s
159159
}
160160

161-
//nolint:ifshort //here a pointer is intentionally saved under the lock
162-
func (c *conn) Unban(ctx context.Context) State {
161+
func (c *conn) Unban(ctx context.Context) State { //nolint:ifshort
163162
var newState State
164163
c.mtx.RLock()
165164
cc := c.grpcConn

internal/decimal/decimal.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ func FromBytes(bts []byte, precision, scale uint32) *big.Int {
6262

6363
v.SetBytes(bts)
6464

65-
if neg := bts[0]&negMask != 0; neg {
65+
neg := bts[0]&negMask != 0
66+
if neg { //nolint:ifshort
6667
// Given bytes contains negative value.
6768
// Interpret is as two's complement.
6869
not(v)
6970
v.Add(v, one)
7071
v.Neg(v)
7172
}
7273
if v.CmpAbs(pow(ten, precision)) >= 0 {
73-
if neg := bts[0]&negMask != 0; neg {
74+
if neg { //nolint:ifshort
7475
v.Set(neginf)
7576
} else {
7677
v.Set(inf)
@@ -88,9 +89,7 @@ func FromInt128(p [16]byte, precision, scale uint32) *big.Int {
8889

8990
// Parse interprets a string s with the given precision and scale and returns
9091
// the corresponding big integer.
91-
//
92-
//nolint:ifshort
93-
func Parse(s string, precision, scale uint32) (*big.Int, error) {
92+
func Parse(s string, precision, scale uint32) (*big.Int, error) { //nolint:ifshort
9493
if scale > precision {
9594
return nil, precisionError(s, precision, scale)
9695
}
@@ -192,9 +191,7 @@ func Parse(s string, precision, scale uint32) (*big.Int, error) {
192191

193192
// Format returns the string representation of x with the given precision and
194193
// scale.
195-
//
196-
//nolint:ifshort //Can't place variable inside if scope because it's used below
197-
func Format(x *big.Int, precision, scale uint32) string {
194+
func Format(x *big.Int, precision, scale uint32) string { //nolint:ifshort
198195
switch {
199196
case x.CmpAbs(inf) == 0:
200197
if x.Sign() < 0 {
@@ -290,8 +287,7 @@ func BigIntToByte(x *big.Int, precision, scale uint32) (p [16]byte) {
290287
return p
291288
}
292289

293-
//nolint:ifshort //Can't place variable inside if scope because it's used one more time below
294-
func put(x *big.Int, p []byte) {
290+
func put(x *big.Int, p []byte) { //nolint:ifshort
295291
neg := x.Sign() < 0
296292
if neg {
297293
x = complement(x)

internal/topic/topicwriterinternal/writer_reconnector.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@ func (w *WriterReconnector) Flush(ctx context.Context) error {
327327
return w.queue.WaitLastWritten(ctx)
328328
}
329329

330-
//nolint:ifshort //putting flushErr into if scope may cause random fails during closing topicwriter with flush
331-
func (w *WriterReconnector) Close(ctx context.Context) error {
330+
func (w *WriterReconnector) Close(ctx context.Context) error { //nolint:ifshort
332331
reason := xerrors.WithStackTrace(errStopWriterReconnector)
333332
w.queue.StopAddNewMessages(reason)
334333

testutil/compare.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@ func compareBytes(l, r *Ydb.Value) int {
290290
}
291291

292292
func compareBool(l, r *Ydb.Value) int {
293+
ll := l.GetBoolValue() //nolint:ifshort
293294
rr := r.GetBoolValue() //nolint:ifshort
294-
if ll := l.GetBoolValue(); ll {
295+
if ll {
295296
if rr {
296297
return 0
297298
}

0 commit comments

Comments
 (0)