Skip to content

Commit 050049d

Browse files
authored
golangci-lint version updated (#67)
1 parent 6841d1d commit 050049d

File tree

10 files changed

+585
-461
lines changed

10 files changed

+585
-461
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
with:
2222
go-version: stable
2323
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v6
24+
uses: golangci/golangci-lint-action@v7
2525
with:
26-
version: v1.64.4
26+
version: v2.1.5
2727

2828
test:
2929
name: go-test

.golangci.bck.yaml

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

.golangci.yaml

Lines changed: 210 additions & 346 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
# Create a stage for building the application.
4-
ARG GO_VERSION=1.23
4+
ARG GO_VERSION=1.24
55
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS build
66
WORKDIR /usr/src/app
77

app

-21 MB
Binary file not shown.

go.mod

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module github.com/stackmon/otc-status-dashboard
22

3-
go 1.23.0
4-
5-
toolchain go1.23.5
3+
go 1.24.2
64

75
require (
86
github.com/DATA-DOG/go-sqlmock v1.5.2
97
github.com/coreos/go-oidc/v3 v3.12.0
108
github.com/gin-gonic/gin v1.10.0
9+
github.com/golang-jwt/jwt/v5 v5.2.1
10+
github.com/gorilla/feeds v1.2.0
1111
github.com/joho/godotenv v1.5.1
1212
github.com/kelseyhightower/envconfig v1.4.0
1313
github.com/stretchr/testify v1.10.0
@@ -29,7 +29,6 @@ require (
2929
github.com/bytedance/sonic/loader v0.2.3 // indirect
3030
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
3131
github.com/cloudwego/base64x v0.1.5 // indirect
32-
github.com/cloudwego/iasm v0.2.0 // indirect
3332
github.com/containerd/log v0.1.0 // indirect
3433
github.com/containerd/platforms v0.2.1 // indirect
3534
github.com/cpuguy83/dockercfg v0.3.2 // indirect
@@ -50,9 +49,7 @@ require (
5049
github.com/go-playground/validator/v10 v10.24.0 // indirect
5150
github.com/goccy/go-json v0.10.4 // indirect
5251
github.com/gogo/protobuf v1.3.2 // indirect
53-
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
5452
github.com/google/uuid v1.6.0 // indirect
55-
github.com/gorilla/feeds v1.2.0 // indirect
5653
github.com/jackc/pgpassfile v1.0.0 // indirect
5754
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
5855
github.com/jackc/pgx/v5 v5.7.2 // indirect
@@ -62,7 +59,6 @@ require (
6259
github.com/json-iterator/go v1.1.12 // indirect
6360
github.com/klauspost/compress v1.17.11 // indirect
6461
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
65-
github.com/kr/pretty v0.3.1 // indirect
6662
github.com/leodido/go-urn v1.4.0 // indirect
6763
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
6864
github.com/magiconair/properties v1.8.9 // indirect
@@ -82,7 +78,6 @@ require (
8278
github.com/pkg/errors v0.9.1 // indirect
8379
github.com/pmezard/go-difflib v1.0.0 // indirect
8480
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
85-
github.com/rogpeppe/go-internal v1.13.1 // indirect
8681
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
8782
github.com/shoenig/go-m1cpu v0.1.6 // indirect
8883
github.com/sirupsen/logrus v1.9.3 // indirect

go.sum

Lines changed: 4 additions & 92 deletions
Large diffs are not rendered by default.

internal/api/rss/rss.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
const generalTitle = "Incidents | Status Dashboard"
1818
const maxIncidents = 10
1919

20-
var errRSSWrongParams = fmt.Errorf( //nolint:stylecheck
20+
var errRSSWrongParams = fmt.Errorf( //nolint:staticcheck
2121
"Status Dashboard RSS feed\nPlease read the documentation to\nmake the correct request",
2222
)
2323

tests/v1_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,14 @@ func checkIncidentsDataAfterMoveV1(t *testing.T, r *gin.Engine) {
302302
incidents := getIncidentsAPIV1(t, r)
303303

304304
for _, inc := range incidents {
305-
if inc.ID == 4 {
305+
switch inc.ID {
306+
case 4:
306307
assert.Nil(t, inc.EndDate)
307308
assert.Equal(t, 3, *inc.Impact)
308309
assert.Len(t, inc.Updates, 1)
309310
assert.Equal(t, "SYSTEM", inc.Updates[0].Status)
310311
assert.Equal(t, "Distributed Cache Service (Database, EU-NL, dcs) moved from <a href='/incidents/2'>Test incident for dcs</a>", inc.Updates[0].Text)
311-
} else if inc.ID == 2 {
312+
case 2:
312313
assert.Nil(t, inc.EndDate)
313314
assert.Equal(t, 2, *inc.Impact)
314315
assert.Len(t, inc.Updates, 3)
@@ -323,12 +324,13 @@ func checkIncidentsDataAfterMovingComponentBetweenIncidentsV1(t *testing.T, r *g
323324
incidents := getIncidentsAPIV1(t, r)
324325

325326
for _, inc := range incidents {
326-
if inc.ID == 4 {
327+
switch inc.ID {
328+
case 4:
327329
assert.Nil(t, inc.EndDate)
328330
assert.Equal(t, 2, *inc.Impact)
329331
assert.Len(t, inc.Updates, 3)
330332
assert.Equal(t, "Distributed Cache Service (Database, EU-NL, dcs) moved to <a href='/incidents/5'>Test incident for moving component between incidents</a>", inc.Updates[2].Text)
331-
} else if inc.ID == 5 {
333+
case 5:
332334
assert.Nil(t, inc.EndDate)
333335
assert.Equal(t, 3, *inc.Impact)
334336
assert.Len(t, inc.Updates, 2)
@@ -351,15 +353,16 @@ func checkIncidentsDataAfterMoveAndClosedIncidentV1(t *testing.T, r *gin.Engine)
351353
incidents := getIncidentsAPIV1(t, r)
352354

353355
for _, inc := range incidents {
354-
if inc.ID == 4 {
356+
switch inc.ID {
357+
case 4:
355358
assert.Nil(t, inc.EndDate)
356359
assert.Equal(t, 3, *inc.Impact)
357360
assert.Len(t, inc.Updates, 2)
358361
assert.Equal(t, "SYSTEM", inc.Updates[0].Status)
359362
assert.Equal(t, "SYSTEM", inc.Updates[1].Status)
360363
assert.Equal(t, "Distributed Cache Service (Database, EU-NL, dcs) moved from <a href='/incidents/2'>Test incident for dcs</a>", inc.Updates[0].Text)
361364
assert.Equal(t, "Cloud Container Engine (Container, EU-NL, cce) moved from <a href='/incidents/2'>Test incident for dcs</a>", inc.Updates[1].Text)
362-
} else if inc.ID == 2 {
365+
case 2:
363366
assert.NotNil(t, inc.EndDate)
364367
assert.Equal(t, 2, *inc.Impact)
365368
assert.Len(t, inc.Updates, 4)

tests/v2_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ func TestV2PostIncidentsHandler(t *testing.T) {
187187
result := v2CreateIncident(t, r, &incidentCreateData)
188188

189189
assert.Len(t, result.Result, len(incidentCreateData.Components))
190-
assert.Equal(t, "", result.Result[0].Error)
191-
assert.Equal(t, "", result.Result[1].Error)
190+
assert.Empty(t, result.Result[0].Error)
191+
assert.Empty(t, result.Result[1].Error)
192192
assert.Equal(t, len(incidents)+1, result.Result[0].IncidentID)
193193
assert.Equal(t, len(incidents)+1, result.Result[1].IncidentID)
194194

@@ -528,7 +528,7 @@ func v2PatchIncident(t *testing.T, r *gin.Engine, inc *v2.Incident) {
528528
d, err := json.Marshal(patch)
529529
require.NoError(t, err)
530530

531-
url := fmt.Sprintf("/v2/incidents/%d", inc.IncidentID.ID)
531+
url := fmt.Sprintf("/v2/incidents/%d", inc.ID)
532532
w := httptest.NewRecorder()
533533
req, _ := http.NewRequest(http.MethodPatch, url, bytes.NewReader(d))
534534

@@ -583,7 +583,7 @@ func TestV2CreateComponentAndList(t *testing.T) {
583583
err := json.Unmarshal(w.Body.Bytes(), &createdComponent)
584584
require.NoError(t, err)
585585
assert.Equal(t, newComponent.Name, createdComponent.Name)
586-
assert.Equal(t, len(newComponent.Attributes), len(createdComponent.Attributes))
586+
assert.Len(t, newComponent.Attributes, len(createdComponent.Attributes))
587587

588588
// Test case 2: Try to create the same component again
589589
t.Log("Test case 2: Try to create duplicate component")
@@ -706,7 +706,7 @@ func TestV2GetComponentsAvailability(t *testing.T) {
706706
targetMonths := map[int]bool{10: true, 11: true, 12: true}
707707

708708
for _, compAvail := range availability.Data {
709-
if compAvail.ComponentID.ID == 7 {
709+
if compAvail.ID == 7 {
710710
checkComponentAvailability(t, compAvail, targetMonths)
711711
}
712712
}

0 commit comments

Comments
 (0)