Skip to content

Commit 4cb0464

Browse files
rekbyasmyasnikov
authored andcommitted
linter rule for allow deprecated ydb.Connection in tests only
persistend allow ydb.Connection for existed common used public functions
1 parent 74f29f8 commit 4cb0464

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ issues:
201201
# Default: []
202202
exclude:
203203
- "has been deprecated since Go 1.16"
204-
- "ydb.Connection is deprecated"
205204

206205
# Independently from option `exclude` we use default exclude patterns,
207206
# it can be disabled by this option. To list all
@@ -236,3 +235,5 @@ issues:
236235
linters:
237236
- unused
238237
- unparam
238+
- path: _test\.go
239+
text: "ydb.Connection is deprecated"

sugar/path.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const (
2323
// pathToCreate is a database root relative path
2424
// MakeRecursive method equal bash command `mkdir -p ~/path/to/create`
2525
// where `~` - is a root of database
26-
func MakeRecursive(ctx context.Context, db ydb.Connection, pathToCreate string) error {
26+
//
27+
// Use deprecated ydb.Connection as param for backward compatibility
28+
// Usually use *ydb.Driver, that implement ydb.Connection
29+
func MakeRecursive(ctx context.Context, db ydb.Connection, pathToCreate string) error { //nolint:staticcheck
2730
pathToCreate = path.Join(db.Name(), pathToCreate)
2831
for i := len(db.Name()) + 1; i < len(pathToCreate); i++ {
2932
x := strings.IndexByte(pathToCreate[i:], '/')
@@ -78,7 +81,10 @@ func MakeRecursive(ctx context.Context, db ydb.Connection, pathToCreate string)
7881
// Empty prefix means than use root of database.
7982
// RemoveRecursive method equal bash command `rm -rf ~/path/to/remove`
8083
// where `~` - is a root of database
81-
func RemoveRecursive(ctx context.Context, db ydb.Connection, pathToRemove string) error {
84+
//
85+
// Use deprecated ydb.Connection as param for backward compatibility
86+
// Usually use *ydb.Driver, that implement ydb.Connection
87+
func RemoveRecursive(ctx context.Context, db ydb.Connection, pathToRemove string) error { //nolint:staticcheck
8288
fullSysTablePath := path.Join(db.Name(), sysTable)
8389
var list func(int, string) error
8490
list = func(i int, p string) error {

0 commit comments

Comments
 (0)