From 72e0952591f667a888b38ba0160dae9e969741be Mon Sep 17 00:00:00 2001 From: PaulYakow Date: Fri, 3 May 2024 07:16:01 +0500 Subject: [PATCH] fix: revert examples/... --- examples/basic/database_sql/main.go | 1 - examples/basic/gorm/main.go | 1 - examples/basic/native/query/main.go | 2 +- examples/basic/native/table/data.go | 1 - examples/basic/native/table/main.go | 2 +- examples/basic/native/table/series.go | 2 +- examples/basic/xorm/main.go | 2 +- examples/coordination/lock/main.go | 4 ++-- examples/coordination/workers/main.go | 8 ++++---- examples/decimal/main.go | 1 - examples/pagination/data.go | 1 - examples/read_table/main.go | 1 - examples/read_table/orders.go | 3 +-- examples/serverless/healthcheck/service.go | 2 +- examples/serverless/url_shortener/main.go | 1 - examples/serverless/url_shortener/service.go | 1 - examples/topic/cdc-cache-bus-freeseats/database.go | 2 +- examples/topic/cdc-cache-bus-freeseats/main.go | 1 - examples/topic/cdc-fill-and-read/main.go | 2 +- examples/topic/cdc-fill-and-read/tables.go | 2 +- examples/topic/topicreader/topicreader_advanced.go | 1 - examples/ttl/main.go | 1 - examples/ttl_readtable/main.go | 1 - 23 files changed, 15 insertions(+), 28 deletions(-) diff --git a/examples/basic/database_sql/main.go b/examples/basic/database_sql/main.go index 57a37f576..e4c31bfe9 100644 --- a/examples/basic/database_sql/main.go +++ b/examples/basic/database_sql/main.go @@ -13,7 +13,6 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/sugar" ) -//nolint:gomnd func main() { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() diff --git a/examples/basic/gorm/main.go b/examples/basic/gorm/main.go index 079917ded..725032216 100644 --- a/examples/basic/gorm/main.go +++ b/examples/basic/gorm/main.go @@ -1,4 +1,3 @@ -//nolint:gomnd package main import ( diff --git a/examples/basic/native/query/main.go b/examples/basic/native/query/main.go index 3879f5015..610690149 100644 --- a/examples/basic/native/query/main.go +++ b/examples/basic/native/query/main.go @@ -47,7 +47,7 @@ func main() { return } - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) //nolint:gomnd + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() dsn, exists := os.LookupEnv("YDB_CONNECTION_STRING") diff --git a/examples/basic/native/table/data.go b/examples/basic/native/table/data.go index c228d87c4..cc4b12547 100644 --- a/examples/basic/native/table/data.go +++ b/examples/basic/native/table/data.go @@ -1,4 +1,3 @@ -//nolint:gomnd package main import ( diff --git a/examples/basic/native/table/main.go b/examples/basic/native/table/main.go index 401954893..b624c4f12 100644 --- a/examples/basic/native/table/main.go +++ b/examples/basic/native/table/main.go @@ -13,7 +13,7 @@ import ( ) func main() { - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) //nolint:gomnd + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() dsn, exists := os.LookupEnv("YDB_CONNECTION_STRING") diff --git a/examples/basic/native/table/series.go b/examples/basic/native/table/series.go index fcea61dfe..2a5bc91b4 100644 --- a/examples/basic/native/table/series.go +++ b/examples/basic/native/table/series.go @@ -285,7 +285,7 @@ func scanQuerySelect(ctx context.Context, c table.Client, prefix string) error { table.ValueParam("$series", types.ListValue( types.Uint64Value(1), - types.Uint64Value(10), //nolint:gomnd + types.Uint64Value(10), ), ), ), diff --git a/examples/basic/xorm/main.go b/examples/basic/xorm/main.go index 7998b3f3e..8a0961af5 100644 --- a/examples/basic/xorm/main.go +++ b/examples/basic/xorm/main.go @@ -22,7 +22,7 @@ SQLITE_CONNECTION_STRING YDB_CONNECTION_STRING` func main() { - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) //nolint:gomnd + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() var ( diff --git a/examples/coordination/lock/main.go b/examples/coordination/lock/main.go index 15cdda1ee..905bb1e4b 100644 --- a/examples/coordination/lock/main.go +++ b/examples/coordination/lock/main.go @@ -76,8 +76,8 @@ func main() { err = db.Coordination().CreateNode(ctx, path, coordination.NodeConfig{ Path: "", - SelfCheckPeriodMillis: 1000, //nolint:gomnd - SessionGracePeriodMillis: 1000, //nolint:gomnd + SelfCheckPeriodMillis: 1000, + SessionGracePeriodMillis: 1000, ReadConsistencyMode: coordination.ConsistencyModeStrict, AttachConsistencyMode: coordination.ConsistencyModeStrict, RatelimiterCountersMode: coordination.RatelimiterCountersModeDetailed, diff --git a/examples/coordination/workers/main.go b/examples/coordination/workers/main.go index b2789b947..451336a7a 100644 --- a/examples/coordination/workers/main.go +++ b/examples/coordination/workers/main.go @@ -49,11 +49,11 @@ func init() { "semaphore prefix", ) flagSet.IntVar(&taskCount, - "tasks", 10, //nolint:gomnd + "tasks", 10, "the number of tasks", ) flagSet.IntVar(&capacity, - "capacity", 4, //nolint:gomnd + "capacity", 4, "the maximum number of tasks a worker can run", ) if err := flagSet.Parse(os.Args[1:]); err != nil { @@ -88,8 +88,8 @@ func main() { err = db.Coordination().CreateNode(ctx, path, coordination.NodeConfig{ Path: "", - SelfCheckPeriodMillis: 1000, //nolint:gomnd - SessionGracePeriodMillis: 1000, //nolint:gomnd + SelfCheckPeriodMillis: 1000, + SessionGracePeriodMillis: 1000, ReadConsistencyMode: coordination.ConsistencyModeStrict, AttachConsistencyMode: coordination.ConsistencyModeStrict, RatelimiterCountersMode: coordination.RatelimiterCountersModeDetailed, diff --git a/examples/decimal/main.go b/examples/decimal/main.go index 6ff6651f3..8e77c2ce1 100644 --- a/examples/decimal/main.go +++ b/examples/decimal/main.go @@ -1,4 +1,3 @@ -//nolint:gomnd package main import ( diff --git a/examples/pagination/data.go b/examples/pagination/data.go index 2c772f433..c64c881c2 100644 --- a/examples/pagination/data.go +++ b/examples/pagination/data.go @@ -12,7 +12,6 @@ func schoolData(city string, num uint32, addr string) types.Value { ) } -//nolint:gomnd func getSchoolData() types.Value { return types.ListValue( schoolData("Орлов", 1, "Ст.Халтурина, 2"), diff --git a/examples/read_table/main.go b/examples/read_table/main.go index 9db6bede1..65a2f45e6 100644 --- a/examples/read_table/main.go +++ b/examples/read_table/main.go @@ -54,7 +54,6 @@ func init() { //nolint:gochecknoinits } } -//nolint:gomnd func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/examples/read_table/orders.go b/examples/read_table/orders.go index 0f517010d..c9e007193 100644 --- a/examples/read_table/orders.go +++ b/examples/read_table/orders.go @@ -85,7 +85,6 @@ type templateConfig struct { TablePathPrefix string } -//nolint:gomnd func fillTable(ctx context.Context, c table.Client, prefix string) (err error) { return c.Do(ctx, func(ctx context.Context, s table.Session) (err error) { @@ -152,7 +151,7 @@ func readTable(ctx context.Context, c table.Client, path string, opts ...options r := row{} for res.NextResultSet(ctx) { for res.NextRow() { - if res.CurrentResultSet().ColumnCount() == 4 { //nolint:gomnd + if res.CurrentResultSet().ColumnCount() == 4 { err = res.ScanNamed( named.OptionalWithDefault("customer_id", &r.id), named.OptionalWithDefault("order_id", &r.orderID), diff --git a/examples/serverless/healthcheck/service.go b/examples/serverless/healthcheck/service.go index 3cce57412..7e5ecb486 100644 --- a/examples/serverless/healthcheck/service.go +++ b/examples/serverless/healthcheck/service.go @@ -36,7 +36,7 @@ func getService(ctx context.Context, dsn string, opts ...ydb.Option) (s *service InsecureSkipVerify: true, //nolint:gosec }, }, - Timeout: time.Second * 10, //nolint:gomnd + Timeout: time.Second * 10, }, } s.db, err = ydb.Open(ctx, dsn, opts...) diff --git a/examples/serverless/url_shortener/main.go b/examples/serverless/url_shortener/main.go index aa486871a..7e8ad0919 100644 --- a/examples/serverless/url_shortener/main.go +++ b/examples/serverless/url_shortener/main.go @@ -21,7 +21,6 @@ var ( logLevel string ) -//nolint:gomnd func init() { //nolint:gochecknoinits required := []string{"ydb"} flagSet := flag.NewFlagSet(os.Args[0], flag.ExitOnError) diff --git a/examples/serverless/url_shortener/service.go b/examples/serverless/url_shortener/service.go index 2c30d7a3d..b87a1a9ea 100644 --- a/examples/serverless/url_shortener/service.go +++ b/examples/serverless/url_shortener/service.go @@ -83,7 +83,6 @@ type service struct { var once sync.Once -//nolint:gomnd func getService(ctx context.Context, dsn string, opts ...ydb.Option) (s *service, err error) { once.Do(func() { var ( diff --git a/examples/topic/cdc-cache-bus-freeseats/database.go b/examples/topic/cdc-cache-bus-freeseats/database.go index bdbd2de09..43ad188ce 100644 --- a/examples/topic/cdc-cache-bus-freeseats/database.go +++ b/examples/topic/cdc-cache-bus-freeseats/database.go @@ -78,7 +78,7 @@ func createCosumers(ctx context.Context, db *ydb.Driver, consumersCount int) err } func connect() *ydb.Driver { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) //nolint:gomnd + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() connectionString := os.Getenv("YDB_CONNECTION_STRING") diff --git a/examples/topic/cdc-cache-bus-freeseats/main.go b/examples/topic/cdc-cache-bus-freeseats/main.go index a62482dc1..1412a47e4 100644 --- a/examples/topic/cdc-cache-bus-freeseats/main.go +++ b/examples/topic/cdc-cache-bus-freeseats/main.go @@ -12,7 +12,6 @@ import ( const defaultConnectionString = "grpc://localhost:2136/local" -//nolint:gomnd var ( host = flag.String("listen-host", "localhost", "host/ip for start listener") port = flag.Int("port", 3619, "port to listen") diff --git a/examples/topic/cdc-fill-and-read/main.go b/examples/topic/cdc-fill-and-read/main.go index 94cd622de..62c39f726 100644 --- a/examples/topic/cdc-fill-and-read/main.go +++ b/examples/topic/cdc-fill-and-read/main.go @@ -49,7 +49,7 @@ func main() { go fillTable(ctx, db.Table(), prefix, tableName) go func() { - time.Sleep(interval / 2) //nolint:gomnd + time.Sleep(interval / 2) removeFromTable(ctx, db.Table(), prefix, tableName) }() diff --git a/examples/topic/cdc-fill-and-read/tables.go b/examples/topic/cdc-fill-and-read/tables.go index f2ac0537a..61281a953 100644 --- a/examples/topic/cdc-fill-and-read/tables.go +++ b/examples/topic/cdc-fill-and-read/tables.go @@ -86,7 +86,7 @@ VALUES `, prefix, tableName) for { id := uint64(rand.Intn(maxID)) //nolint:gosec - val := "val-" + strconv.Itoa(rand.Intn(10)) //nolint:gosec,gomnd + val := "val-" + strconv.Itoa(rand.Intn(10)) //nolint:gosec params := table.NewQueryParameters( table.ValueParam("$id", types.Uint64Value(id)), table.ValueParam("$value", types.UTF8Value(val)), diff --git a/examples/topic/topicreader/topicreader_advanced.go b/examples/topic/topicreader/topicreader_advanced.go index f4c9618ce..e9e7e6a2e 100644 --- a/examples/topic/topicreader/topicreader_advanced.go +++ b/examples/topic/topicreader/topicreader_advanced.go @@ -32,7 +32,6 @@ type MyMessage struct { // UnmarshalYDBTopicMessage implements topicreader.MessageContentUnmarshaler interface func (m *MyMessage) UnmarshalYDBTopicMessage(data []byte) error { - //nolint:gomnd if len(data) != 6 { return errBadDataLen } diff --git a/examples/ttl/main.go b/examples/ttl/main.go index 0d58b958f..b185fc4a4 100644 --- a/examples/ttl/main.go +++ b/examples/ttl/main.go @@ -52,7 +52,6 @@ func init() { //nolint:gochecknoinits } } -//nolint:gomnd func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/examples/ttl_readtable/main.go b/examples/ttl_readtable/main.go index 947633d60..d0612ddf6 100644 --- a/examples/ttl_readtable/main.go +++ b/examples/ttl_readtable/main.go @@ -52,7 +52,6 @@ func init() { //nolint:gochecknoinits } } -//nolint:gomnd func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel()