Skip to content

Commit

Permalink
Merge pull request #87 from Tinee/bug-override-current-cluster-brokers
Browse files Browse the repository at this point in the history
Removed mutation of currentClusters.Brokers .
  • Loading branch information
birdayz committed Nov 19, 2019
2 parents 7c2817c + 7373088 commit 16ee675
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config.go
Expand Up @@ -76,7 +76,11 @@ func (c *Config) ActiveCluster() *Cluster {

for _, cluster := range c.Clusters {
if cluster.Name == toSearch {
return cluster
// Make copy of cluster struct, using a pointer leads to unintended
// behavior where modifications on currentCluster are written back
// into the config
c := *cluster
return &c
}
}
return nil
Expand Down

0 comments on commit 16ee675

Please sign in to comment.