Skip to content

Commit d1f6e5b

Browse files
authored
Merge pull request #1032 from kupriyanovkk/master
enable errname linter
2 parents aa249f5 + 511a202 commit d1f6e5b

File tree

13 files changed

+43
-44
lines changed

13 files changed

+43
-44
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ linters:
223223
- cyclop
224224
- depguard
225225
- dupl
226-
- errname
227226
- exhaustive
228227
- exhaustivestruct
229228
- exhaustruct

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242

4343
## v3.54.2
4444
* Added context to some internal methods for better tracing
45-
* Added `trace.FunctionID` helper and `FunctionID` field to trace start info's
45+
* Added `trace.FunctionID` helper and `FunctionID` field to trace start info's
4646
* Replaced lazy initialization of ydb clients (table, topic, etc.) to explicit initialization on `ydb.Open` step
4747

4848
## v3.54.1
49-
* Fixed inconsistent labels in `metrics`
49+
* Fixed inconsistent labels in `metrics`
5050

5151
## v3.54.0
52-
* Allowed `sql.LevelSerializable` isolation level in read-write mode in `database/sql` transactions
52+
* Allowed `sql.LevelSerializable` isolation level in read-write mode in `database/sql` transactions
5353
* Refactored traces and metrics
5454
* Added `{retry,table}.WithLabel` options for mark retriers calls
5555
* Added `ydb.WithTraceRetry` option
@@ -73,7 +73,7 @@
7373
* Fixed stringification of credentials object
7474

7575
## v3.53.2
76-
* Fixed panic when try to unwrap values with more than 127 columns with custom ydb unmarshaler
76+
* Fixed panic when try to unwrap values with more than 127 columns with custom ydb unmarshaler
7777

7878
## v3.53.1
7979
* Bumps `github.com/ydb-platform/ydb-go-genproto` for support `query` service
@@ -222,7 +222,7 @@
222222
* Added `table/options.WithCallOptions` options for append custom grpc call options into `session.{BulkUpsert,Execute,StreamExecuteScanQuery}`
223223
* Supported fake transactions in `database/sql` driver over connector option `ydb.WithFakeTx(queryMode)` and connection string param `go_fake_tx`
224224
* Removed `testutil/timeutil` package (all usages replaced with `clockwork` package)
225-
* Changed behaviour of retryer on transport errors `cancelled` and `deadline exceeded` - will retry idempotent operation if context is not done
225+
* Changed behaviour of retryer on transport errors `cancelled` and `deadline exceeded` - will retry idempotent operation if context is not done
226226
* Added address of node to operation error description as optional
227227
* Fixed bug with put session from unknown node
228228
* Fixed bug with parsing of `TzTimestamp` without microseconds

internal/conn/error_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@ func TestNodeErrorIs(t *testing.T) {
3232
require.NotErrorIs(t, nodeErr, testErr2)
3333
}
3434

35-
type testErrorType1 struct {
35+
type testType1Error struct {
3636
msg string
3737
}
3838

39-
func (t testErrorType1) Error() string {
39+
func (t testType1Error) Error() string {
4040
return "1 - " + t.msg
4141
}
4242

43-
type testErrorType2 struct {
43+
type testType2Error struct {
4444
msg string
4545
}
4646

47-
func (t testErrorType2) Error() string {
47+
func (t testType2Error) Error() string {
4848
return "2 - " + t.msg
4949
}
5050

5151
func TestNodeErrorAs(t *testing.T) {
52-
testErr := testErrorType1{msg: "test"}
52+
testErr := testType1Error{msg: "test"}
5353
nodeErr := newConnError(1, "localhost:1234", testErr)
5454

55-
target := testErrorType1{}
55+
target := testType1Error{}
5656
require.ErrorAs(t, nodeErr, &target)
5757
require.Equal(t, testErr, target)
5858

59-
target2 := testErrorType2{}
59+
target2 := testType2Error{}
6060
require.False(t, errors.As(nodeErr, &target2))
6161
}

internal/topic/topicreaderinternal/decoders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (m *decoderMap) Decode(codec rawtopiccommon.Codec, input io.Reader) (io.Rea
3636
}
3737

3838
return nil, xerrors.WithStackTrace(xerrors.Wrap(
39-
fmt.Errorf("ydb: failed decompress message with codec %v: %w", codec, PublicErrUnexpectedCodec),
39+
fmt.Errorf("ydb: failed decompress message with codec %v: %w", codec, ErrPublicUnexpectedCodec),
4040
))
4141
}
4242

internal/topic/topicreaderinternal/message.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414

1515
var errMessageWasReadEarly = xerrors.Wrap(errors.New("ydb: message was read early"))
1616

17-
// PublicErrUnexpectedCodec return when try to read message content with unknown codec
18-
var PublicErrUnexpectedCodec = errors.New("unexpected codec") //nolint:revive,stylecheck
17+
// ErrPublicUnexpectedCodec return when try to read message content with unknown codec
18+
var ErrPublicUnexpectedCodec = errors.New("unexpected codec")
1919

2020
// PublicMessage is representation of topic message
2121
type PublicMessage struct {

internal/xcontext/context_error.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@ import (
44
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
55
)
66

7-
var _ error = (*ctxErr)(nil)
7+
var _ error = (*ctxError)(nil)
88

99
const (
1010
atWord = "at"
1111
fromWord = "from"
1212
)
1313

1414
func errAt(err error, skipDepth int) error {
15-
return &ctxErr{
15+
return &ctxError{
1616
err: err,
1717
stackRecord: stack.Record(skipDepth + 1),
1818
linkWord: atWord,
1919
}
2020
}
2121

2222
func errFrom(err error, from string) error {
23-
return &ctxErr{
23+
return &ctxError{
2424
err: err,
2525
stackRecord: from,
2626
linkWord: fromWord,
2727
}
2828
}
2929

30-
type ctxErr struct {
30+
type ctxError struct {
3131
err error
3232
stackRecord string
3333
linkWord string
3434
}
3535

36-
func (e *ctxErr) Error() string {
36+
func (e *ctxError) Error() string {
3737
return "'" + e.err.Error() + "' " + e.linkWord + " `" + e.stackRecord + "`"
3838
}
3939

40-
func (e *ctxErr) Unwrap() error {
40+
func (e *ctxError) Unwrap() error {
4141
return e.err
4242
}

internal/xerrors/issues.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (ii issues) String() string {
5757

5858
// NewWithIssues returns error which contains child issues
5959
func NewWithIssues(text string, issues ...error) error {
60-
err := &errorWithIssues{
60+
err := &withIssuesError{
6161
reason: text,
6262
}
6363
for i := range issues {
@@ -69,14 +69,14 @@ func NewWithIssues(text string, issues ...error) error {
6969
return err
7070
}
7171

72-
type errorWithIssues struct {
72+
type withIssuesError struct {
7373
reason string
7474
issues []error
7575
}
7676

77-
func (e *errorWithIssues) isYdbError() {}
77+
func (e *withIssuesError) isYdbError() {}
7878

79-
func (e *errorWithIssues) Error() string {
79+
func (e *withIssuesError) Error() string {
8080
var b bytes.Buffer
8181
if len(e.reason) > 0 {
8282
b.WriteString(e.reason)
@@ -95,7 +95,7 @@ func (e *errorWithIssues) Error() string {
9595
return b.String()
9696
}
9797

98-
func (e *errorWithIssues) As(target interface{}) bool {
98+
func (e *withIssuesError) As(target interface{}) bool {
9999
for _, err := range e.issues {
100100
if As(err, target) {
101101
return true
@@ -105,7 +105,7 @@ func (e *errorWithIssues) As(target interface{}) bool {
105105
return false
106106
}
107107

108-
func (e *errorWithIssues) Is(target error) bool {
108+
func (e *withIssuesError) Is(target error) bool {
109109
for _, err := range e.issues {
110110
if Is(err, target) {
111111
return true

internal/xerrors/join.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring"
77
)
88

9-
func Join(errs ...error) joinError {
9+
func Join(errs ...error) joinErrors {
1010
return errs
1111
}
1212

13-
type joinError []error
13+
type joinErrors []error
1414

15-
func (errs joinError) Error() string {
15+
func (errs joinErrors) Error() string {
1616
b := xstring.Buffer()
1717
defer b.Free()
1818
b.WriteByte('[')
@@ -27,7 +27,7 @@ func (errs joinError) Error() string {
2727
return b.String()
2828
}
2929

30-
func (errs joinError) As(target interface{}) bool {
30+
func (errs joinErrors) As(target interface{}) bool {
3131
for _, err := range errs {
3232
if As(err, target) {
3333
return true
@@ -37,7 +37,7 @@ func (errs joinError) As(target interface{}) bool {
3737
return false
3838
}
3939

40-
func (errs joinError) Is(target error) bool {
40+
func (errs joinErrors) Is(target error) bool {
4141
for _, err := range errs {
4242
if Is(err, target) {
4343
return true
@@ -47,6 +47,6 @@ func (errs joinError) Is(target error) bool {
4747
return false
4848
}
4949

50-
func (errs joinError) Unwrap() []error {
50+
func (errs joinErrors) Unwrap() []error {
5151
return errs
5252
}

internal/xerrors/join_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestJoin(t *testing.T) {
1212
for _, tt := range []struct {
13-
err joinError
13+
err joinErrors
1414
iss []error
1515
ass []interface{}
1616
s string

internal/xsql/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func (c *conn) BeginTx(ctx context.Context, txOptions driver.TxOptions) (_ drive
465465
if c.currentTx != nil {
466466
return nil, xerrors.WithStackTrace(
467467
xerrors.Retryable(
468-
&ErrConnAlreadyHaveTx{
468+
&ConnAlreadyHaveTxError{
469469
currentTx: c.currentTx.ID(),
470470
},
471471
xerrors.WithDeleteSession(),

0 commit comments

Comments
 (0)