From 0a7d42b04af11cbbd780ecf73764b1c25c9b411a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 14 Oct 2025 20:20:24 +0000 Subject: [PATCH 1/3] golangci-lint-action v8 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af153ffbf..fcb488b6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - go: [ "1.24", "1.23" ] + go: [ "1.25", "1.23" ] os: [ ubuntu-latest, ubuntu-24.04, ubuntu-22.04 ] name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules runs-on: ${{ matrix.os }} @@ -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 From ef16bbf7817670915175269ec27908b35be003fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 14 Oct 2025 20:22:17 +0000 Subject: [PATCH 2/3] golangci-lint run --fix --- canal/expr.go | 2 +- canal/sync.go | 2 +- client/resp.go | 4 ++-- mysql/error.go | 2 +- mysql/mysql_gtid.go | 4 ++-- mysql/resultset_helper.go | 2 +- replication/event.go | 4 ++-- replication/row_event.go | 23 +++++++++++------------ serialization/serialization.go | 2 +- 9 files changed, 22 insertions(+), 23 deletions(-) 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< Date: Tue, 14 Oct 2025 21:16:34 +0000 Subject: [PATCH 3/3] 1.24 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcb488b6e..9517abe78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - go: [ "1.25", "1.23" ] + go: [ "1.24", "1.23" ] os: [ ubuntu-latest, ubuntu-24.04, ubuntu-22.04 ] name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules runs-on: ${{ matrix.os }}