Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable exhaustruct linter #1034

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
63e141b
enable exhaustruct
kozyrev-m Feb 2, 2024
d4987d9
refactor initialization of 'endpoint' structure
kozyrev-m Feb 7, 2024
62a8dfc
refactor initialization of structures in internal/allocator/allocator.go
kozyrev-m Feb 9, 2024
4581e51
refactor initialization of structures in internal/backoff
kozyrev-m Feb 10, 2024
328f5da
refactor initialization of structures in internal/bind
kozyrev-m Feb 11, 2024
46235d2
edit CHANGELOG.md
kozyrev-m Feb 13, 2024
4bec025
refactor initialization of structures in internal/certificates
kozyrev-m Feb 13, 2024
5f97257
add explicit initialization of fileds of structures in internal/crede…
kozyrev-m Feb 13, 2024
db2ee7f
Merge branch 'master' into master
asmyasnikov Feb 28, 2024
7b7836f
add explicit initialization of fileds of structures in internal/grpcw…
kozyrev-m Mar 6, 2024
6f77315
add explicit initialization of fileds of structures in internal/meta
kozyrev-m Mar 10, 2024
eae4e54
switch off the exhaustruct linter for tests
kozyrev-m Mar 26, 2024
b8da064
Merge branch 'master' into master
kozyrev-m Apr 5, 2024
6f63136
again fixes in internal/meta
kozyrev-m Apr 5, 2024
80b050f
add explicit initialization of fields of structures in internal/opera…
kozyrev-m Apr 5, 2024
b27a4ac
add explicit initialization of fields of structures in internal/params
kozyrev-m Apr 5, 2024
4b7d44c
add explicit initialization of fields of structures in internal/pool
kozyrev-m Apr 6, 2024
2a19aad
add explicit initialization of fields of structures in internal/query
kozyrev-m Apr 6, 2024
ddaede2
add explicit initialization of fields of structures in internal/ratel…
kozyrev-m Apr 6, 2024
c3eedbb
add explicit initialization of fields of structures in internal/repeater
kozyrev-m Apr 8, 2024
e83898e
add explicit initialization of fields of structures in internal/scheme
kozyrev-m Apr 8, 2024
985c533
add explicit initialization of fields of structures in internal/scrip…
kozyrev-m Apr 8, 2024
e9064ef
add explicit initialization of fields of structures in internal/stack
kozyrev-m Apr 8, 2024
a85a737
add explicit initialization of fields of structures in internal/table
kozyrev-m Apr 15, 2024
2970590
add explicit initialization of fields of structures in internal/types
kozyrev-m Apr 15, 2024
bf69614
add explicit initialization of fields of structures in internal/value
kozyrev-m Apr 15, 2024
14511ab
add explicit initialization of fields of structures in internal/xcontext
kozyrev-m Apr 15, 2024
4140b14
add explicit initialization of fields of structures in internal/xerrors
kozyrev-m Apr 15, 2024
2db1efb
add explicit initialization of fields of structures in internal/xrand
kozyrev-m Apr 15, 2024
f0406f6
add explicit initialization of fields of structures in internal/xsql
kozyrev-m Apr 16, 2024
a1b0e00
add explicit initialization of fields of structures in internal/xstring
kozyrev-m Apr 16, 2024
a711da6
add explicit initialization of fields of structures in internal/xsync
kozyrev-m Apr 16, 2024
377162e
add explicit initialization of fields of structures in internal/xtest
kozyrev-m Apr 16, 2024
18b64b7
add explicit initialization of fields of structures in internal/backg…
kozyrev-m Apr 19, 2024
33bb8e5
add explicit initialization of fields of structures in internal/cmd
kozyrev-m Apr 19, 2024
447e72a
add explicit initialization of fields of structures in internal/balancer
kozyrev-m Apr 19, 2024
6c43dee
add explicit initialization of fields of structures in internal/conn
kozyrev-m Apr 19, 2024
17091a9
add explicit initialization of fields of structures in internal/coord…
kozyrev-m Apr 20, 2024
0916f1b
add explicit initialization of fields of structures in internal/disco…
kozyrev-m Apr 20, 2024
2f525ee
add explicit initialization of fields of structures in internal/topic
kozyrev-m Apr 21, 2024
9df7a9f
add explicit initialization of fields of structures in balancers/
kozyrev-m Apr 22, 2024
64786ca
add explicit initialization of fields of structures in config/
kozyrev-m Apr 22, 2024
04e6850
add explicit initialization of fields of structures in log/
kozyrev-m Apr 23, 2024
d87408a
add explicit initialization of fields of structures in retry/
kozyrev-m Apr 23, 2024
6187a25
add explicit initialization of fields of structures in scheme/
kozyrev-m Apr 23, 2024
b6ad7b8
add explicit initialization of fields of structures in sugar/
kozyrev-m Apr 23, 2024
137ff0e
add explicit initialization of fields of structures in table/
kozyrev-m Apr 24, 2024
afc8ce6
add explicit initialization of fields of structures in testutil/
kozyrev-m Apr 24, 2024
0e8696d
add explicit initialization of fields of structures in topic/
kozyrev-m Apr 24, 2024
f4da376
add explicit initialization of fields of structures in trace/
kozyrev-m Apr 24, 2024
85b78ec
fix marks from exhaustruct linter for driver.go
kozyrev-m Apr 24, 2024
3282eff
add explicit initialization of fields of structures in sql.go
kozyrev-m Apr 24, 2024
06032b3
add explicit initialization of fields of structures in examples/basic
kozyrev-m Apr 24, 2024
2cf5b70
add explicit initialization of fields of structures in examples/read_…
kozyrev-m Apr 24, 2024
90ca7de
add explicit initialization of fields of structures in examples/serve…
kozyrev-m Apr 24, 2024
01ea3c0
add explicit initialization of fields of structures in examples/topic
kozyrev-m Apr 24, 2024
c5058c4
add explicit initialization of fields of structures in tests/slo
kozyrev-m Apr 24, 2024
99d28ce
resolve conflicts
kozyrev-m May 5, 2024
299daa4
add explicit initialization of fields of structures in internal/; log…
kozyrev-m May 5, 2024
a5cc73c
fix import in internal/allocator/allocator.go
kozyrev-m May 5, 2024
47f0fc8
Merge branch 'master' into master
kozyrev-m May 13, 2024
0f3a9c0
resolve conflicts
kozyrev-m May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ linters:
- dupl
- exhaustive
- exhaustivestruct
- exhaustruct
- forbidigo
- funlen
- gochecknoglobals
Expand Down Expand Up @@ -296,6 +295,7 @@ issues:
- unused
- unparam
- gocritic
- exhaustruct
- forcetypeassert
- path: topic/topicreader/reader_example_test.go
linters:
Expand Down
19 changes: 16 additions & 3 deletions balancers/balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,29 @@ import (
// Will be removed after Oct 2024.
// Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func RoundRobin() *balancerConfig.Config {
return &balancerConfig.Config{}
return &balancerConfig.Config{
Filter: nil,
AllowFallback: false,
SingleConn: false,
DetectLocalDC: false,
}
}

func RandomChoice() *balancerConfig.Config {
return &balancerConfig.Config{}
return &balancerConfig.Config{
Filter: nil,
AllowFallback: false,
SingleConn: false,
DetectLocalDC: false,
}
}

func SingleConn() *balancerConfig.Config {
return &balancerConfig.Config{
SingleConn: true,
Filter: nil,
AllowFallback: false,
SingleConn: true,
DetectLocalDC: false,
}
}

Expand Down
1 change: 1 addition & 0 deletions balancers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func FromConfig(config string, opts ...fromConfigOption) *balancerConfig.Config
var (
h = fromConfigOptionsHolder{
fallbackBalancer: Default(),
errorHandler: nil,
}
b *balancerConfig.Config
err error
Expand Down
28 changes: 20 additions & 8 deletions config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/ydb-platform/ydb-go-sdk/v3/balancers"
"github.com/ydb-platform/ydb-go-sdk/v3/credentials"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/config"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xresolver"
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
Expand Down Expand Up @@ -78,20 +79,31 @@ func certPool() *x509.CertPool {
}

func defaultTLSConfig() *tls.Config {
return &tls.Config{
MinVersion: tls.VersionTLS12,
RootCAs: certPool(),
}
config := new(tls.Config)

config.MinVersion = tls.VersionTLS12
config.RootCAs = certPool()

return config
}

func defaultConfig() (c *Config) {
return &Config{
credentials: credentials.NewAnonymousCredentials(
credentials.WithSourceInfo(stack.Record(0)),
),
balancerConfig: balancers.Default(),
tlsConfig: defaultTLSConfig(),
dialTimeout: DefaultDialTimeout,
trace: &trace.Driver{},
balancerConfig: balancers.Default(),
tlsConfig: defaultTLSConfig(),
dialTimeout: DefaultDialTimeout,
trace: new(trace.Driver),
Common: config.Common{},
connectionTTL: time.Duration(0),
secure: false,
endpoint: "",
database: "",
metaOptions: nil,
grpcOptions: nil,
meta: nil,
excludeGRPCCodesForPessimization: nil,
}
}
9 changes: 4 additions & 5 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (d *Driver) trace() *trace.Driver {
return d.config.Trace()
}

return &trace.Driver{}
return new(trace.Driver)
}

// Close closes Driver and clear resources
Expand Down Expand Up @@ -316,10 +316,9 @@ func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, e
}
}()

d := &Driver{
children: make(map[uint64]*Driver),
ctxCancel: driverCtxCancel,
}
d := new(Driver)
d.children = make(map[uint64]*Driver)
d.ctxCancel = driverCtxCancel

if caFile, has := os.LookupEnv("YDB_SSL_ROOT_CERTIFICATES_FILE"); has {
d.opts = append(d.opts,
Expand Down
Loading
Loading