diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af153ffbf..9517abe78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,7 @@ jobs: with: go-version: stable - name: golangci-lint - uses: golangci/golangci-lint-action@v7 + uses: golangci/golangci-lint-action@v8 with: version: latest args: --timeout=3m diff --git a/canal/expr.go b/canal/expr.go index 5257e1b99..020e85fe2 100644 --- a/canal/expr.go +++ b/canal/expr.go @@ -43,7 +43,7 @@ func (ve *valueExpr) GetString() string { return "" func (ve *valueExpr) GetProjectionOffset() int { return 0 } func (ve *valueExpr) SetProjectionOffset(offset int) {} func (ve *valueExpr) Restore(ctx *format.RestoreCtx) error { return nil } -func (ve *valueExpr) Accept(v ast.Visitor) (node ast.Node, ok bool) { return } +func (ve *valueExpr) Accept(v ast.Visitor) (node ast.Node, ok bool) { return node, ok } func (ve *valueExpr) Text() string { return "" } func (ve *valueExpr) SetText(enc charset.Encoding, text string) {} func (ve *valueExpr) Format(w io.Writer) {} diff --git a/canal/sync.go b/canal/sync.go index 253cdf4c0..595074b2c 100644 --- a/canal/sync.go +++ b/canal/sync.go @@ -249,7 +249,7 @@ func (c *Canal) updateTable(header *replication.EventHeader, db, table string) ( if err = c.eventHandler.OnTableChanged(header, db, table); err != nil && errors.Cause(err) != schema.ErrTableNotExist { return errors.Trace(err) } - return + return err } func (c *Canal) updateReplicationDelay(ev *replication.BinlogEvent) { diff --git a/client/resp.go b/client/resp.go index 071aafa27..8d77b480e 100644 --- a/client/resp.go +++ b/client/resp.go @@ -20,12 +20,12 @@ func (c *Conn) readUntilEOF() (err error) { for { data, err = c.ReadPacket() if err != nil { - return + return err } // EOF Packet if c.isEOFPacket(data) { - return + return err } } } diff --git a/mysql/error.go b/mysql/error.go index e9915779b..b40d6be35 100644 --- a/mysql/error.go +++ b/mysql/error.go @@ -62,5 +62,5 @@ func ErrorCode(errMsg string) (code int) { var tmpStr string // golang scanf doesn't support %*,so I used a temporary variable _, _ = fmt.Sscanf(errMsg, "%s%d", &tmpStr, &code) - return + return code } diff --git a/mysql/mysql_gtid.go b/mysql/mysql_gtid.go index 67ac52ac3..20b26ffc9 100644 --- a/mysql/mysql_gtid.go +++ b/mysql/mysql_gtid.go @@ -42,14 +42,14 @@ func parseInterval(str string) (i Interval, err error) { } if err != nil { - return + return i, err } if i.Stop <= i.Start { err = errors.Errorf("invalid interval format, must n[-n] and the end must >= start") } - return + return i, err } func (i Interval) String() string { diff --git a/mysql/resultset_helper.go b/mysql/resultset_helper.go index c9fb814de..402fee68b 100644 --- a/mysql/resultset_helper.go +++ b/mysql/resultset_helper.go @@ -143,7 +143,7 @@ func fieldType(value interface{}) (typ uint8, err error) { default: err = errors.Errorf("unsupport type %T for resultset", value) } - return + return typ, err } func formatField(field *Field, value interface{}) error { diff --git a/replication/event.go b/replication/event.go index c7b848db4..f1a6f4ca4 100644 --- a/replication/event.go +++ b/replication/event.go @@ -254,10 +254,10 @@ func decodeSid(data []byte) (format GtidFormat, sidnr uint64) { masked := make([]byte, 8) copy(masked, data[1:7]) sidnr = binary.LittleEndian.Uint64(masked) - return + return format, sidnr } sidnr = binary.LittleEndian.Uint64(data[:8]) - return + return format, sidnr } func (e *PreviousGTIDsEvent) Decode(data []byte) error { diff --git a/replication/row_event.go b/replication/row_event.go index 62e34318d..14190ceeb 100644 --- a/replication/row_event.go +++ b/replication/row_event.go @@ -344,18 +344,18 @@ func (e *TableMapEvent) decodeIntSeq(v []byte) (ret []uint64, err error) { p += n ret = append(ret, i) } - return + return ret, err } func (e *TableMapEvent) decodeDefaultCharset(v []byte) (ret []uint64, err error) { ret, err = e.decodeIntSeq(v) if err != nil { - return + return ret, err } if len(ret)%2 != 1 { return nil, errors.Errorf("Expect odd item in DefaultCharset but got %d", len(ret)) } - return + return ret, err } func (e *TableMapEvent) decodeColumnNames(v []byte) error { @@ -390,7 +390,7 @@ func (e *TableMapEvent) decodeStrValue(v []byte) (ret [][][]byte, err error) { } ret = append(ret, vals) } - return + return ret, err } func (e *TableMapEvent) decodeSimplePrimaryKey(v []byte) error { @@ -561,7 +561,7 @@ func (e *TableMapEvent) Dump(w io.Writer) { // i must be in range [0, ColumnCount). func (e *TableMapEvent) Nullable(i int) (available, nullable bool) { if len(e.NullBitmap) == 0 { - return + return available, nullable } return true, e.NullBitmap[i/8]&(1<