Skip to content

Commit

Permalink
Merge pull request #665 from skoef/gosimple
Browse files Browse the repository at this point in the history
enabled gosimple in golangci
  • Loading branch information
lance6716 authored Jan 19, 2022
2 parents da5d50a + 8422eeb commit d8b74c3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ linters:
- unconvert
- whitespace
- govet
- gosimple
- ineffassign
# ToDo:
#- gosimple
#- gocritic
#- golint
linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion canal/canal.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (c *Canal) GetTable(db string, table string) (*schema.Table, error) {
c.tableLock.RLock()
lastTime, ok := c.errorTablesGetTime[key]
c.tableLock.RUnlock()
if ok && time.Now().Sub(lastTime) < UnknownTableRetryPeriod {
if ok && time.Since(lastTime) < UnknownTableRetryPeriod {
return nil, schema.ErrMissingTableMeta
}
}
Expand Down
2 changes: 1 addition & 1 deletion canal/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (c *Canal) dump() error {
startPos = h.gset
}
log.Infof("dump MySQL and parse OK, use %0.2f seconds, start binlog replication at %s",
time.Now().Sub(start).Seconds(), startPos)
time.Since(start).Seconds(), startPos)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion dump/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (d *Dumper) AddTables(db string, tables ...string) {
}

func (d *Dumper) AddIgnoreTables(db string, tables ...string) {
t, _ := d.IgnoreTables[db]
t := d.IgnoreTables[db]
t = append(t, tables...)
d.IgnoreTables[db] = t
}
Expand Down
2 changes: 1 addition & 1 deletion dump/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var valuesExp *regexp.Regexp
var gtidExp *regexp.Regexp

func init() {
binlogExp = regexp.MustCompile("^CHANGE MASTER TO MASTER_LOG_FILE='(.+)', MASTER_LOG_POS=(\\d+);")
binlogExp = regexp.MustCompile(`^CHANGE MASTER TO MASTER_LOG_FILE='(.+)', MASTER_LOG_POS=(\d+);`)
useExp = regexp.MustCompile("^USE `(.+)`;")
valuesExp = regexp.MustCompile("^INSERT INTO `(.+?)` VALUES \\((.+)\\);$")
// The pattern will only match MySQL GTID, as you know SET GLOBAL gtid_slave_pos='0-1-4' is used for MariaDB.
Expand Down
2 changes: 1 addition & 1 deletion replication/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (e *PreviousGTIDsEvent) Decode(data []byte) error {
}
previousGTIDSets = append(previousGTIDSets, fmt.Sprintf("%s:%s", uuid, strings.Join(intervals, ":")))
}
e.GTIDSets = fmt.Sprintf("%s", strings.Join(previousGTIDSets, ","))
e.GTIDSets = strings.Join(previousGTIDSets, ",")
return nil
}

Expand Down

0 comments on commit d8b74c3

Please sign in to comment.