Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo committed Jul 24, 2024
1 parent 4834099 commit 73cdfc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ linters:
- wsl
- funlen
- gocognit
- gomnd
- goprintffuncname
- paralleltest
- nlreturn
Expand Down
12 changes: 6 additions & 6 deletions pkg/table/tableinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (t *TableInfo) IsModified(ctx context.Context) (bool, error) {
}

// Compare key columns.
keyColumns, _, _, _, err := t.fetchPrimaryKey(ctx)
keyColumns, _, _, _, err := t.fetchPrimaryKey(ctx) //nolint: dogsled
if err != nil {
return true, err
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func (t *TableInfo) fetchPrimaryKey(ctx context.Context) (keyColumns []string, k
t.TableName,
)
if err != nil {
return
return //nolint: nakedret
}
defer rows.Close()
for rows.Next() {
Expand All @@ -247,19 +247,19 @@ func (t *TableInfo) fetchPrimaryKey(ctx context.Context) (keyColumns []string, k
}
if rows.Err() != nil {
err = rows.Err()
return
return //nolint: nakedret
}
if len(keyColumns) == 0 {
err = errors.New("no primary key found (not supported)")
return
return //nolint: nakedret
}
for i, col := range keyColumns {
// Get primary key type and auto_inc info.
query := "SELECT column_type, extra FROM information_schema.columns WHERE table_schema=? AND table_name=? and column_name=?"
var extra, pkType string
err = t.db.QueryRowContext(ctx, query, t.SchemaName, t.TableName, col).Scan(&pkType, &extra)
if err != nil {
return nil, false, nil, nil, err
return //nolint: nakedret
}
pkType = removeWidth(pkType)
keyColumnsMySQLTp = append(keyColumnsMySQLTp, pkType)
Expand All @@ -269,7 +269,7 @@ func (t *TableInfo) fetchPrimaryKey(ctx context.Context) (keyColumns []string, k
}
}
err = nil
return
return //nolint: nakedret
}

// PrimaryKeyIsMemoryComparable checks that the PRIMARY KEY type is compatible.
Expand Down

0 comments on commit 73cdfc8

Please sign in to comment.