Skip to content

Commit 5b52556

Browse files
committed
Migrate golangci-lint to v2
* Migrate golangci-lint config to v2. * Fixup linting issues. Signed-off-by: SuperQ <[email protected]>
1 parent 752f8d7 commit 5b52556

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

.golangci.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
---
1+
version: "2"
22
linters:
33
enable:
4-
- sloglint
5-
6-
run:
7-
timeout: 5m
8-
9-
issues:
10-
exclude-rules:
11-
- path: _test.go
12-
linters:
13-
- errcheck
4+
- sloglint
5+
exclusions:
6+
rules:
7+
- linters:
8+
- errcheck
9+
path: _test.go

collectors/monitoring_collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func (c *MonitoringCollector) reportTimeSeriesMetrics(
424424
for _, point := range timeSeries.Points {
425425
endTime, err := time.Parse(time.RFC3339Nano, point.Interval.EndTime)
426426
if err != nil {
427-
return fmt.Errorf("Error parsing TimeSeries Point interval end time `%s`: %s", point.Interval.EndTime, err)
427+
return fmt.Errorf("error parsing TimeSeries Point interval end time `%s`: %s", point.Interval.EndTime, err)
428428
}
429429
if endTime.After(newestEndTime) {
430430
newestEndTime = endTime
@@ -541,7 +541,7 @@ func (c *MonitoringCollector) generateHistogramBuckets(
541541
bucketKeys[i] = opts.ExponentialBuckets.Scale * math.Pow(opts.ExponentialBuckets.GrowthFactor, float64(i))
542542
}
543543
default:
544-
return nil, errors.New("Unknown distribution buckets")
544+
return nil, errors.New("unknown distribution buckets")
545545
}
546546
// The last bucket is always infinity
547547
// @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/TypedValue#bucketoptions

stackdriver_exporter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func getDefaultGCPProject(ctx context.Context) (*string, error) {
161161
func createMonitoringService(ctx context.Context) (*monitoring.Service, error) {
162162
googleClient, err := google.DefaultClient(ctx, monitoring.MonitoringReadScope)
163163
if err != nil {
164-
return nil, fmt.Errorf("Error creating Google client: %v", err)
164+
return nil, fmt.Errorf("error creating Google client: %v", err)
165165
}
166166

167167
googleClient.Timeout = *stackdriverHttpTimeout
@@ -175,7 +175,7 @@ func createMonitoringService(ctx context.Context) (*monitoring.Service, error) {
175175

176176
monitoringService, err := monitoring.NewService(ctx, option.WithHTTPClient(googleClient), option.WithUniverseDomain(*googleUniverseDomain))
177177
if err != nil {
178-
return nil, fmt.Errorf("Error creating Google Stackdriver Monitoring service: %v", err)
178+
return nil, fmt.Errorf("error creating Google Stackdriver Monitoring service: %v", err)
179179
}
180180

181181
return monitoringService, nil

0 commit comments

Comments
 (0)