Skip to content

Commit 7f66f49

Browse files
committed
fix: pass by reference
Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
1 parent ef96407 commit 7f66f49

File tree

8 files changed

+10
-12
lines changed

8 files changed

+10
-12
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
# Install golang
1212
- uses: actions/setup-go@v2
1313
with:
14-
go-version: 1.22.0
14+
go-version: 1.20.0
1515

1616
# Checkout to the latest commit
1717
# On specific directory/path
@@ -98,7 +98,7 @@ jobs:
9898
# Install golang
9999
- uses: actions/setup-go@v2
100100
with:
101-
go-version: 1.22.0
101+
go-version: 1.20.0
102102

103103
# Checkout to the latest commit
104104
# On specific directory/path

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
# Install golang
1414
- uses: actions/setup-go@v2
1515
with:
16-
go-version: 1.22.0
16+
go-version: 1.20.0
1717

1818
# Checkout to the latest commit
1919
# On specific directory/path

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
# Install golang
1212
- uses: actions/setup-go@v2
1313
with:
14-
go-version: 1.22.0
14+
go-version: 1.20.0
1515

1616
# Checkout to the latest commit
1717
# On specific directory/path

controller/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func Exporter(clientSet clients.ClientSets, wq workqueue.RateLimitingInterface)
4747
// refresh metrics whenever there's a change in chaosengine or chaosresult
4848
// or every informer resync duration, whichever is earlier
4949
for _, done := wq.Get(); !done; _, done = wq.Get() {
50-
needRequeue, err := r.GetLitmusChaosMetrics(clientSet, overallChaosResults, &monitoringEnabled)
50+
needRequeue, err := r.GetLitmusChaosMetrics(clientSet, &overallChaosResults, &monitoringEnabled)
5151
if err != nil {
5252
log.Errorf("err: %v", err)
5353
}

controller/scrap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestGetLitmusChaosMetrics(t *testing.T) {
7373
tt.execFunc()
7474

7575
client := CreateFakeClient(t)
76-
_, err := r.GetLitmusChaosMetrics(client, tt.overallChaosResult, tt.monitoring)
76+
_, err := r.GetLitmusChaosMetrics(client, &tt.overallChaosResult, tt.monitoring)
7777
if tt.isErr {
7878
require.Error(t, err)
7979
return

controller/scrape.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
var err error
3636

3737
// GetLitmusChaosMetrics derive and send the chaos metrics
38-
func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, overallChaosResults []*litmuschaosv1alpha1.ChaosResult, monitoringEnabled *MonitoringEnabled) (*time.Duration, error) {
38+
func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, overallChaosResults *[]*litmuschaosv1alpha1.ChaosResult, monitoringEnabled *MonitoringEnabled) (*time.Duration, error) {
3939
engineCount := 0
4040

4141
// initialising the parameters for the namespaced scope metrics
@@ -59,9 +59,9 @@ func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, ov
5959
return nil, err
6060
}
6161
// unset the metrics correspond to deleted chaosresults
62-
m.GaugeMetrics.unsetDeletedChaosResults(overallChaosResults, resultList)
62+
m.GaugeMetrics.unsetDeletedChaosResults(*overallChaosResults, resultList)
6363
// updating the overall chaosresults items to latest
64-
overallChaosResults = resultList
64+
*overallChaosResults = resultList
6565

6666
var needRequeue *time.Duration
6767

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/litmuschaos/chaos-exporter
22

3-
go 1.22
3+
go 1.20
44

55
require (
66
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er
178178
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
179179
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
180180
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
181-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
182181
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
183182
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
184183
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
@@ -834,7 +833,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
834833
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
835834
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
836835
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
837-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
838836
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
839837
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
840838
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=

0 commit comments

Comments
 (0)