Skip to content

Commit

Permalink
fix: revert examples/...
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulYakow committed May 3, 2024
1 parent 4f9373a commit 72e0952
Show file tree
Hide file tree
Showing 23 changed files with 15 additions and 28 deletions.
1 change: 0 additions & 1 deletion examples/basic/database_sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion examples/basic/gorm/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:gomnd
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/native/query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion examples/basic/native/table/data.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:gomnd
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/native/table/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/native/table/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/xorm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions examples/coordination/lock/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions examples/coordination/workers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion examples/decimal/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:gomnd
package main

import (
Expand Down
1 change: 0 additions & 1 deletion examples/pagination/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 0 additions & 1 deletion examples/read_table/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func init() { //nolint:gochecknoinits
}
}

//nolint:gomnd
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
3 changes: 1 addition & 2 deletions examples/read_table/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion examples/serverless/healthcheck/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
1 change: 0 additions & 1 deletion examples/serverless/url_shortener/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var (
logLevel string
)

//nolint:gomnd
func init() { //nolint:gochecknoinits
required := []string{"ydb"}
flagSet := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
Expand Down
1 change: 0 additions & 1 deletion examples/serverless/url_shortener/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion examples/topic/cdc-cache-bus-freeseats/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion examples/topic/cdc-cache-bus-freeseats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/topic/cdc-fill-and-read/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}()

Expand Down
2 changes: 1 addition & 1 deletion examples/topic/cdc-fill-and-read/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
1 change: 0 additions & 1 deletion examples/topic/topicreader/topicreader_advanced.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion examples/ttl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func init() { //nolint:gochecknoinits
}
}

//nolint:gomnd
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
1 change: 0 additions & 1 deletion examples/ttl_readtable/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func init() { //nolint:gochecknoinits
}
}

//nolint:gomnd
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down

0 comments on commit 72e0952

Please sign in to comment.