Skip to content

Commit cdad252

Browse files
committed
Change golangci to enable all
1 parent 863b2aa commit cdad252

File tree

12 files changed

+132
-80
lines changed

12 files changed

+132
-80
lines changed

.golangci.yml

Lines changed: 20 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -225,66 +225,27 @@ linters-settings:
225225
# Default: false
226226
checkExported: true
227227
linters:
228-
disable-all: true
229-
enable:
230-
# - cyclop
228+
enable-all: true
229+
disable:
230+
- godot
231+
- varnamelen
232+
- wrapcheck
233+
- nosnakecase
234+
- deadcode
235+
- golint
236+
- interfacer
237+
- maligned
238+
- ifshort
239+
- structcheck
240+
- exhaustivestruct
241+
- scopelint
242+
- varcheck
243+
- ireturn
231244
- depguard
232-
- dogsled
233-
# - dupl
234-
- errcheck
235-
- errorlint
236-
# - exhaustive
237-
# - exhaustivestruct
238-
# - forbidigo
239-
# - funlen
240-
# - gci
241-
# - gocognit
242-
- goconst
243-
- gocritic
244-
- gocyclo
245-
# - godot
246-
- godox
247-
- gofmt # On why gofmt when goimports is enabled - https://github.com/golang/go/issues/21476
248-
- gofumpt
249-
- goheader
250-
- goimports
251-
# - gomnd
252-
# - gomoddirectives
253-
# - gomodguard
254-
- gosec
255-
- gosimple
256-
- govet
257-
- depguard
258-
# - ifshort
259-
# - ireturn
260-
- lll
261-
- makezero
262-
- misspell
263-
- ineffassign
264-
- misspell
265-
- nakedret
266-
- nestif
267-
# - nilnil
268-
# - nlreturn
269-
- nolintlint
270-
- prealloc
271-
- predeclared
272-
- rowserrcheck
273-
- revive
274-
- staticcheck
275-
- stylecheck
276-
# - tagliatelle
277-
# - testpackage
278-
# - thelper
279-
# - tenv
280-
- typecheck
281-
- unconvert
282-
- unparam
283-
- unused
284-
# - varnamelen
285-
- whitespace
286-
# - wrapcheck
287-
# - wsl
245+
- wsl
246+
- exhaustruct
247+
- gci
248+
- paralleltest #need be enabled
288249

289250
issues:
290251
# List of regexps of issue texts to exclude, empty list by default.

connection.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
// Interface and list of clients may be changed in the future
1717
//
1818
// Deprecated: use directly *Driver type from ydb.Open instead
19+
//
20+
//nolint:interfacebloat
1921
type Connection interface {
2022
// Endpoint returns initial endpoint
2123
Endpoint() string

driver.go

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,13 @@ func (d *Driver) trace() *trace.Driver {
9797
if d.config != nil {
9898
return d.config.Trace()
9999
}
100+
100101
return &trace.Driver{}
101102
}
102103

103104
// Close closes Driver and clear resources
105+
//
106+
//nolint:nonamedreturns
104107
func (d *Driver) Close(ctx context.Context) (finalErr error) {
105108
onDone := trace.DriverOnClose(d.trace(), &ctx, stack.FunctionID(""))
106109
defer func() {
@@ -207,6 +210,8 @@ func (d *Driver) Topic() topic.Client {
207210
// "grpc[s]://{endpoint}/{database}[?param=value]"
208211
//
209212
// See sugar.DSN helper for make dsn from endpoint and database
213+
//
214+
//nolint:nonamedreturns
210215
func Open(ctx context.Context, dsn string, opts ...Option) (_ *Driver, err error) {
211216
d, err := newConnectionFromOptions(ctx, append(
212217
[]Option{
@@ -239,12 +244,15 @@ func MustOpen(ctx context.Context, dsn string, opts ...Option) *Driver {
239244
if err != nil {
240245
panic(err)
241246
}
247+
242248
return db
243249
}
244250

245251
// New connects to database and return driver runtime holder
246252
//
247253
// Deprecated: use Open with required param connectionString instead
254+
//
255+
//nolint:nonamedreturns
248256
func New(ctx context.Context, opts ...Option) (_ *Driver, err error) {
249257
d, err := newConnectionFromOptions(ctx, opts...)
250258
if err != nil {
@@ -267,6 +275,7 @@ func New(ctx context.Context, opts ...Option) (_ *Driver, err error) {
267275
return d, nil
268276
}
269277

278+
//nolint:cyclop, nonamedreturns
270279
func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, err error) {
271280
d := &Driver{
272281
children: make(map[uint64]*Driver),
@@ -304,16 +313,16 @@ func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, e
304313
}
305314
if d.logger != nil {
306315
for _, opt := range []Option{
307-
WithTraceDriver(log.Driver(d.logger, d.loggerDetails, d.loggerOpts...)),
308-
WithTraceTable(log.Table(d.logger, d.loggerDetails, d.loggerOpts...)),
309-
WithTraceScripting(log.Scripting(d.logger, d.loggerDetails, d.loggerOpts...)),
316+
WithTraceDriver(log.Driver(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
317+
WithTraceTable(log.Table(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
318+
WithTraceScripting(log.Scripting(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
310319
WithTraceScheme(log.Scheme(d.logger, d.loggerDetails, d.loggerOpts...)),
311320
WithTraceCoordination(log.Coordination(d.logger, d.loggerDetails, d.loggerOpts...)),
312321
WithTraceRatelimiter(log.Ratelimiter(d.logger, d.loggerDetails, d.loggerOpts...)),
313-
WithTraceDiscovery(log.Discovery(d.logger, d.loggerDetails, d.loggerOpts...)),
314-
WithTraceTopic(log.Topic(d.logger, d.loggerDetails, d.loggerOpts...)),
315-
WithTraceDatabaseSQL(log.DatabaseSQL(d.logger, d.loggerDetails, d.loggerOpts...)),
316-
WithTraceRetry(log.Retry(d.logger, d.loggerDetails, d.loggerOpts...)),
322+
WithTraceDiscovery(log.Discovery(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
323+
WithTraceTopic(log.Topic(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
324+
WithTraceDatabaseSQL(log.DatabaseSQL(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
325+
WithTraceRetry(log.Retry(d.logger, d.loggerDetails, d.loggerOpts...)), //nolint:contextcheck
317326
} {
318327
if opt != nil {
319328
err = opt(ctx, d)
@@ -324,16 +333,18 @@ func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, e
324333
}
325334
}
326335
d.config = config.New(d.options...)
336+
327337
return d, nil
328338
}
329339

340+
//nolint:cyclop, nonamedreturns, funlen
330341
func (d *Driver) connect(ctx context.Context) (err error) {
331342
if d.config.Endpoint() == "" {
332-
return xerrors.WithStackTrace(errors.New("configuration: empty dial address"))
343+
return xerrors.WithStackTrace(errors.New("configuration: empty dial address")) //nolint:goerr113
333344
}
334345

335346
if d.config.Database() == "" {
336-
return xerrors.WithStackTrace(errors.New("configuration: empty database"))
347+
return xerrors.WithStackTrace(errors.New("configuration: empty database")) //nolint:goerr113
337348
}
338349

339350
if d.userInfo != nil {

errors.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ func IsOperationErrorSchemeError(err error) bool {
8383
}
8484

8585
// IsOperationErrorTransactionLocksInvalidated checks does err a TLI issue
86+
//
87+
//nolint:nonamedreturns
8688
func IsOperationErrorTransactionLocksInvalidated(err error) (isTLI bool) {
8789
return xerrors.IsOperationErrorTransactionLocksInvalidated(err)
8890
}

0 commit comments

Comments
 (0)