Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
fix linter
  • Loading branch information
notanonymousenough committed Dec 11, 2023
1 parent c993b19 commit 01245a1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 31 deletions.
3 changes: 3 additions & 0 deletions examples/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
disable:
- forbidgo
1 change: 1 addition & 0 deletions internal/balancer/connections_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func TestSelectRandomConnection(t *testing.T) {
})
}

//nolint:dupl
func TestNewState(t *testing.T) {
table := []struct {
name string
Expand Down
1 change: 1 addition & 0 deletions internal/version/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestParse(t *testing.T) {
}
}

//nolint:dupl
func TestLt(t *testing.T) {
for _, tt := range []struct {
lhs string
Expand Down
30 changes: 0 additions & 30 deletions internal/xsql/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,36 +759,6 @@ func (c *conn) GetTables(ctx context.Context, folder string, recursive, excludeS
}
}

func (c *conn) GetIndexes(ctx context.Context, tableName string) (indexes []string, _ error) {
tableName = c.normalizePath(tableName)
tableExists, err := helpers.IsEntryExists(ctx,
c.connector.parent.Scheme(), tableName,
scheme.EntryTable, scheme.EntryColumnTable,
)
if err != nil {
return nil, xerrors.WithStackTrace(err)
}
if !tableExists {
return nil, xerrors.WithStackTrace(fmt.Errorf("table '%s' not exist", tableName))
}

err = retry.Retry(ctx, func(ctx context.Context) (err error) {
desc, err := c.session.DescribeTable(ctx, tableName)
if err != nil {
return err
}
for i := range desc.Indexes {
indexes = append(indexes, desc.Indexes[i].Name)
}
return nil
}, retry.WithIdempotent(true))
if err != nil {
return nil, xerrors.WithStackTrace(err)
}

return indexes, nil
}

func (c *conn) GetIndexColumns(ctx context.Context, tableName, indexName string) (columns []string, _ error) {
tableName = c.normalizePath(tableName)
tableExists, err := helpers.IsEntryExists(ctx,
Expand Down
1 change: 1 addition & 0 deletions log/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func DatabaseSQL(l Logger, d trace.Detailer, opts ...Option) (t trace.DatabaseSQ
return internalDatabaseSQL(wrapLogger(l, opts...), d)
}

//nolint:dupl
func internalDatabaseSQL(l *wrapper, d trace.Detailer) (t trace.DatabaseSQL) {
t.OnConnectorConnect = func(
info trace.DatabaseSQLConnectorConnectStartInfo,
Expand Down
2 changes: 1 addition & 1 deletion log/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Table(l Logger, d trace.Detailer, opts ...Option) (t trace.Table) {
return internalTable(wrapLogger(l, opts...), d)
}

//nolint:gocyclo
//nolint:gocyclo, dupl
func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) {
t.OnDo = func(
info trace.TableDoStartInfo,
Expand Down
3 changes: 3 additions & 0 deletions tests/slo/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
disable:
- forbidgo

0 comments on commit 01245a1

Please sign in to comment.