Skip to content

Commit

Permalink
refactor initialization of 'endpoint' structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kozyrev-m committed Feb 7, 2024
1 parent 63e141b commit d4987d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Added explicit initialization of all fields of the `endpoint` structure in `internal/endpoint/endpoint.go`, when golangci-lint exhaustruct enabled

* Fixed topic writer infinite reconnections in some cases
* Refactored nil on err `internal/grpcwrapper/rawydb/issues.go`, when golangci-lint nilerr enabled
* Refactored nil on err `internal/grpcwrapper/rawtopic/describe_topic.go`, when golangci-lint nilerr enabled
Expand Down
7 changes: 7 additions & 0 deletions internal/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (e *endpoint) Copy() Endpoint {
defer e.mu.RUnlock()

return &endpoint{
mu: sync.RWMutex{},
id: e.id,
address: e.address,
location: e.location,
Expand Down Expand Up @@ -160,7 +161,13 @@ func withLastUpdated(ts time.Time) Option {

func New(address string, opts ...Option) *endpoint {
e := &endpoint{
mu: sync.RWMutex{},
id: 0,
address: address,
location: "",
services: []string{},
loadFactor: 0,
local: false,
lastUpdated: time.Now(),
}
for _, o := range opts {
Expand Down

0 comments on commit d4987d9

Please sign in to comment.