mirror of
https://github.com/clastix/kamaji.git
synced 2026-08-26 00:47:20 +00:00
chore: resolve prealloc linter issues (PR9) (#1270)
* chore: resolve prealloc linter issues (PR9) Preallocate slice with capacity in nats.go * chore: resolve prealloc linter issues (PR9) Preallocate the ep slice in NewNATSConnection with capacity equal to the length of config.Endpoints since we know the final size in advance. This avoids unnecessary memory allocations during the slice append loop. Reset go.mod and go.sum to their previous versions to remove out-of-scope dependency version changes.
This commit is contained in:
@@ -27,7 +27,7 @@ func NewNATSConnection(config ConnectionConfig) (*NATSConnection, error) {
|
||||
|
||||
if len(config.Endpoints) > 1 {
|
||||
// comma separated list of endpoints
|
||||
var ep []string
|
||||
ep := make([]string, 0, len(config.Endpoints))
|
||||
for _, e := range config.Endpoints {
|
||||
ep = append(ep, fmt.Sprintf("nats://%s", e.String()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user