Skip to content

Commit 77df36d

Browse files
committed
moved nolint hints
1 parent 0338de0 commit 77df36d

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
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: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ func Err() *big.Int { return big.NewInt(0).Set(err) }
5454
//
5555
// If given bytes contains value that is greater than given precision it
5656
// returns infinity or negative infinity value accordingly the bytes sign.
57-
func FromBytes(bts []byte, precision, scale uint32) *big.Int {
57+
func FromBytes(bts []byte, precision, scale uint32) *big.Int { //nolint:ifshort
5858
v := big.NewInt(0)
5959
if len(bts) == 0 {
6060
return v
6161
}
6262

6363
v.SetBytes(bts)
64-
65-
if neg := bts[0]&negMask != 0; neg {
64+
neg := bts[0]&negMask != 0
65+
if neg {
6666
// Given bytes contains negative value.
6767
// Interpret is as two's complement.
6868
not(v)
6969
v.Add(v, one)
7070
v.Neg(v)
7171
}
7272
if v.CmpAbs(pow(ten, precision)) >= 0 {
73-
if neg := bts[0]&negMask != 0; neg {
73+
if neg {
7474
v.Set(neginf)
7575
} else {
7676
v.Set(inf)
@@ -88,9 +88,7 @@ func FromInt128(p [16]byte, precision, scale uint32) *big.Int {
8888

8989
// Parse interprets a string s with the given precision and scale and returns
9090
// the corresponding big integer.
91-
//
92-
//nolint:ifshort
93-
func Parse(s string, precision, scale uint32) (*big.Int, error) {
91+
func Parse(s string, precision, scale uint32) (*big.Int, error) { //nolint:ifshort
9492
if scale > precision {
9593
return nil, precisionError(s, precision, scale)
9694
}
@@ -192,9 +190,7 @@ func Parse(s string, precision, scale uint32) (*big.Int, error) {
192190

193191
// Format returns the string representation of x with the given precision and
194192
// 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 {
193+
func Format(x *big.Int, precision, scale uint32) string { //nolint:ifshort
198194
switch {
199195
case x.CmpAbs(inf) == 0:
200196
if x.Sign() < 0 {
@@ -290,8 +286,7 @@ func BigIntToByte(x *big.Int, precision, scale uint32) (p [16]byte) {
290286
return p
291287
}
292288

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) {
289+
func put(x *big.Int, p []byte) { //nolint:ifshort
295290
neg := x.Sign() < 0
296291
if neg {
297292
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

0 commit comments

Comments
 (0)