Skip to content

Commit d4987d9

Browse files
committed
refactor initialization of 'endpoint' structure
1 parent 63e141b commit d4987d9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added explicit initialization of all fields of the `endpoint` structure in `internal/endpoint/endpoint.go`, when golangci-lint exhaustruct enabled
2+
13
* Fixed topic writer infinite reconnections in some cases
24
* Refactored nil on err `internal/grpcwrapper/rawydb/issues.go`, when golangci-lint nilerr enabled
35
* Refactored nil on err `internal/grpcwrapper/rawtopic/describe_topic.go`, when golangci-lint nilerr enabled

internal/endpoint/endpoint.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func (e *endpoint) Copy() Endpoint {
4141
defer e.mu.RUnlock()
4242

4343
return &endpoint{
44+
mu: sync.RWMutex{},
4445
id: e.id,
4546
address: e.address,
4647
location: e.location,
@@ -160,7 +161,13 @@ func withLastUpdated(ts time.Time) Option {
160161

161162
func New(address string, opts ...Option) *endpoint {
162163
e := &endpoint{
164+
mu: sync.RWMutex{},
165+
id: 0,
163166
address: address,
167+
location: "",
168+
services: []string{},
169+
loadFactor: 0,
170+
local: false,
164171
lastUpdated: time.Now(),
165172
}
166173
for _, o := range opts {

0 commit comments

Comments
 (0)