Skip to content

Commit ef16bbf

Browse files
committed
golangci-lint run --fix
1 parent 0a7d42b commit ef16bbf

File tree

9 files changed

+22
-23
lines changed

9 files changed

+22
-23
lines changed

canal/expr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (ve *valueExpr) GetString() string { return ""
4343
func (ve *valueExpr) GetProjectionOffset() int { return 0 }
4444
func (ve *valueExpr) SetProjectionOffset(offset int) {}
4545
func (ve *valueExpr) Restore(ctx *format.RestoreCtx) error { return nil }
46-
func (ve *valueExpr) Accept(v ast.Visitor) (node ast.Node, ok bool) { return }
46+
func (ve *valueExpr) Accept(v ast.Visitor) (node ast.Node, ok bool) { return node, ok }
4747
func (ve *valueExpr) Text() string { return "" }
4848
func (ve *valueExpr) SetText(enc charset.Encoding, text string) {}
4949
func (ve *valueExpr) Format(w io.Writer) {}

canal/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (c *Canal) updateTable(header *replication.EventHeader, db, table string) (
249249
if err = c.eventHandler.OnTableChanged(header, db, table); err != nil && errors.Cause(err) != schema.ErrTableNotExist {
250250
return errors.Trace(err)
251251
}
252-
return
252+
return err
253253
}
254254

255255
func (c *Canal) updateReplicationDelay(ev *replication.BinlogEvent) {

client/resp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ func (c *Conn) readUntilEOF() (err error) {
2020
for {
2121
data, err = c.ReadPacket()
2222
if err != nil {
23-
return
23+
return err
2424
}
2525

2626
// EOF Packet
2727
if c.isEOFPacket(data) {
28-
return
28+
return err
2929
}
3030
}
3131
}

mysql/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ func ErrorCode(errMsg string) (code int) {
6262
var tmpStr string
6363
// golang scanf doesn't support %*,so I used a temporary variable
6464
_, _ = fmt.Sscanf(errMsg, "%s%d", &tmpStr, &code)
65-
return
65+
return code
6666
}

mysql/mysql_gtid.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ func parseInterval(str string) (i Interval, err error) {
4242
}
4343

4444
if err != nil {
45-
return
45+
return i, err
4646
}
4747

4848
if i.Stop <= i.Start {
4949
err = errors.Errorf("invalid interval format, must n[-n] and the end must >= start")
5050
}
5151

52-
return
52+
return i, err
5353
}
5454

5555
func (i Interval) String() string {

mysql/resultset_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func fieldType(value interface{}) (typ uint8, err error) {
143143
default:
144144
err = errors.Errorf("unsupport type %T for resultset", value)
145145
}
146-
return
146+
return typ, err
147147
}
148148

149149
func formatField(field *Field, value interface{}) error {

replication/event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ func decodeSid(data []byte) (format GtidFormat, sidnr uint64) {
254254
masked := make([]byte, 8)
255255
copy(masked, data[1:7])
256256
sidnr = binary.LittleEndian.Uint64(masked)
257-
return
257+
return format, sidnr
258258
}
259259
sidnr = binary.LittleEndian.Uint64(data[:8])
260-
return
260+
return format, sidnr
261261
}
262262

263263
func (e *PreviousGTIDsEvent) Decode(data []byte) error {

replication/row_event.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,18 @@ func (e *TableMapEvent) decodeIntSeq(v []byte) (ret []uint64, err error) {
344344
p += n
345345
ret = append(ret, i)
346346
}
347-
return
347+
return ret, err
348348
}
349349

350350
func (e *TableMapEvent) decodeDefaultCharset(v []byte) (ret []uint64, err error) {
351351
ret, err = e.decodeIntSeq(v)
352352
if err != nil {
353-
return
353+
return ret, err
354354
}
355355
if len(ret)%2 != 1 {
356356
return nil, errors.Errorf("Expect odd item in DefaultCharset but got %d", len(ret))
357357
}
358-
return
358+
return ret, err
359359
}
360360

361361
func (e *TableMapEvent) decodeColumnNames(v []byte) error {
@@ -390,7 +390,7 @@ func (e *TableMapEvent) decodeStrValue(v []byte) (ret [][][]byte, err error) {
390390
}
391391
ret = append(ret, vals)
392392
}
393-
return
393+
return ret, err
394394
}
395395

396396
func (e *TableMapEvent) decodeSimplePrimaryKey(v []byte) error {
@@ -561,7 +561,7 @@ func (e *TableMapEvent) Dump(w io.Writer) {
561561
// i must be in range [0, ColumnCount).
562562
func (e *TableMapEvent) Nullable(i int) (available, nullable bool) {
563563
if len(e.NullBitmap) == 0 {
564-
return
564+
return available, nullable
565565
}
566566
return true, e.NullBitmap[i/8]&(1<<uint(i%8)) != 0
567567
}
@@ -1082,8 +1082,7 @@ func (e *RowsEvent) DecodeData(pos int, data []byte) (err2 error) {
10821082
if e.compressed {
10831083
data, err2 = mysql.DecompressMariadbData(data[pos:])
10841084
if err2 != nil {
1085-
//nolint:nakedret
1086-
return
1085+
return err2
10871086
}
10881087
pos = 0
10891088
}
@@ -1481,7 +1480,7 @@ func decodeString(data []byte, length int) (v string, n int) {
14811480
v = utils.ByteSliceToString(data[2:n])
14821481
}
14831482

1484-
return
1483+
return v, n
14851484
}
14861485

14871486
// ref: https://github.com/mysql/mysql-server/blob/a9b0c712de3509d8d08d3ba385d41a4df6348775/strings/decimal.c#L137
@@ -1502,7 +1501,7 @@ func decodeDecimalDecompressValue(compIndx int, data []byte, mask uint8) (size i
15021501
case 4:
15031502
value = uint32(data[3]^mask) | uint32(data[2]^mask)<<8 | uint32(data[1]^mask)<<16 | uint32(data[0]^mask)<<24
15041503
}
1505-
return
1504+
return size, value
15061505
}
15071506

15081507
var zeros = [digitsPerInteger]byte{48, 48, 48, 48, 48, 48, 48, 48, 48}
@@ -1625,7 +1624,7 @@ func decodeBit(data []byte, nbits int, length int) (value int64, err error) {
16251624
value = int64(data[0])
16261625
}
16271626
}
1628-
return
1627+
return value, err
16291628
}
16301629

16311630
func littleDecodeBit(data []byte, nbits int, length int) (value int64, err error) {
@@ -1657,7 +1656,7 @@ func littleDecodeBit(data []byte, nbits int, length int) (value int64, err error
16571656
value = int64(data[0])
16581657
}
16591658
}
1660-
return
1659+
return value, err
16611660
}
16621661

16631662
func decodeTimestamp2(data []byte, dec uint16, timestampStringLocation *time.Location) (interface{}, int, error) {
@@ -1859,7 +1858,7 @@ func decodeBlob(data []byte, meta uint16) (v []byte, n int, err error) {
18591858
err = fmt.Errorf("invalid blob packlen = %d", meta)
18601859
}
18611860

1862-
return
1861+
return v, n, err
18631862
}
18641863

18651864
func (e *RowsEvent) Dump(w io.Writer) {

serialization/serialization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (f *Format) stringParts() (parts []string) {
5858
parts = append(parts, fmt.Sprintf(" Value: %s", f.Type.String()))
5959
}
6060
}
61-
return
61+
return parts
6262
}
6363

6464
// Field represents a `message_field`

0 commit comments

Comments
 (0)