Skip to content

Commit

Permalink
gocritic: switch ifelse with case statement
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelbirkner committed Sep 15, 2023
1 parent 9091f55 commit d6ddb63
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/telemetrygen/internal/metrics/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ func (w worker) simulateMetrics(res *resource.Resource, exporter sdkmetric.Expor
var i int64
for w.running.Load() {
var metrics []metricdata.Metrics
if w.metricType == metricTypeGauge {

switch w.metricType {
case metricTypeGauge:
metrics = append(metrics, metricdata.Metrics{
Name: "gen",
Data: metricdata.Gauge[int64]{
DataPoints: []metricdata.DataPoint[int64]{
{
Time: time.Now(),
Value: i,
Time: time.Now(),
Value: i,
},
},
},
})
} else if w.metricType == metricTypeSum {
case metricTypeSum:
metrics = append(metrics, metricdata.Metrics{
Name: "gen",
Data: metricdata.Sum[int64]{
Expand All @@ -60,7 +62,7 @@ func (w worker) simulateMetrics(res *resource.Resource, exporter sdkmetric.Expor
},
},
})
} else {
default:
w.logger.Fatal("unknown metric type")
}

Expand Down

0 comments on commit d6ddb63

Please sign in to comment.