Skip to content

Commit

Permalink
fix make check
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Nov 21, 2023
1 parent 4f2086d commit 323231b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
5 changes: 1 addition & 4 deletions pkg/sink/codec/simple/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ func (d *decoder) NextRowChangedEvent() (*model.RowChangedEvent, error) {
return nil, cerror.ErrCodecDecode.GenWithStack(
"not found row changed event message")
}
event, err := buildRowChangedEvent(d.msg)
if err != nil {
return nil, err
}
event := buildRowChangedEvent(d.msg)
d.msg = nil
return event, nil
}
Expand Down
20 changes: 6 additions & 14 deletions pkg/sink/codec/simple/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func newDDLEvent(msg *message) *model.DDLEvent {
}
}

func buildRowChangedEvent(msg *message) (*model.RowChangedEvent, error) {
func buildRowChangedEvent(msg *message) *model.RowChangedEvent {
result := &model.RowChangedEvent{
CommitTs: msg.CommitTs,
Table: &model.TableName{
Expand All @@ -227,24 +227,16 @@ func buildRowChangedEvent(msg *message) (*model.RowChangedEvent, error) {
}

if msg.Data != nil {
columns, err := buildColumns(msg.Data)
if err != nil {
return nil, err
}
result.Columns = columns
result.Columns = buildColumns(msg.Data)
}

if msg.Old != nil {
columns, err := buildColumns(msg.Old)
if err != nil {
return nil, err
}
result.PreColumns = columns
result.PreColumns = buildColumns(msg.Old)
}
return result, nil
return result
}

func buildColumns(rawData map[string]string) ([]*model.Column, error) {
func buildColumns(rawData map[string]string) []*model.Column {
result := make([]*model.Column, 0, len(rawData))
for name, value := range rawData {
col := &model.Column{
Expand All @@ -253,7 +245,7 @@ func buildColumns(rawData map[string]string) ([]*model.Column, error) {
}
result = append(result, col)
}
return result, nil
return result
}

type message struct {
Expand Down

0 comments on commit 323231b

Please sign in to comment.