diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index ab4101b5ff..90784bcc0c 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -54,13 +54,13 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: latest + version: v1.58 working-directory: backend/app - name: golangci-lint on example directory uses: golangci/golangci-lint-action@v3 with: - version: latest + version: v1.58 args: --config ../../.golangci.yml working-directory: backend/_example/memory_store diff --git a/backend/.golangci.yml b/backend/.golangci.yml index 9c94c15f36..2fd8e75df2 100644 --- a/backend/.golangci.yml +++ b/backend/.golangci.yml @@ -1,15 +1,10 @@ run: timeout: 5m - output: - format: tab - skip-dirs: - - vendor linters-settings: govet: - check-shadowing: true - maligned: - suggest-new: true + enable: + - shadow goconst: min-len: 2 min-occurrences: 2 @@ -31,7 +26,9 @@ linters-settings: linters: enable: - bodyclose - - megacheck + - gosimple + - staticcheck + - unused - revive - govet - unconvert @@ -54,6 +51,8 @@ linters: disable-all: true issues: + exclude-dirs: + - vendor exclude-rules: - text: "at least one file in a package should have a package comment" linters: diff --git a/backend/app/rest/api/rest_public_test.go b/backend/app/rest/api/rest_public_test.go index 8e05e43ec7..53c693cb7e 100644 --- a/backend/app/rest/api/rest_public_test.go +++ b/backend/app/rest/api/rest_public_test.go @@ -669,11 +669,11 @@ func TestPublic_FindCommentsCtrl_ConsistentCount(t *testing.T) { {"sort=+score", fmt.Sprintf(`"score":10,"vote":0,"time":%q}],"info":{"count":7`, formattedTS[2])}, {"sort=+score&url=test-url", fmt.Sprintf(`"score":10,"vote":0,"time":%q}],"info":{"url":"test-url","count":6`, formattedTS[2])}, {"sort=-score", fmt.Sprintf(`"score":-25,"vote":0,"time":%q}],"info":{"count":7`, formattedTS[8])}, - {"sort=-score&url=test-url", fmt.Sprintf(`"score":-2,"vote":0,"controversy":1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":6`, formattedTS[6])}, + {"sort=-score&url=test-url", fmt.Sprintf(`"score":-2,"vote":0,"controversy":v1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":6`, formattedTS[6])}, {"sort=-time&since=" + sinceTS[4], fmt.Sprintf(`"score":-1,"vote":0,"controversy":2.924017738212866,"time":%q}],"info":{"count":3`, formattedTS[4])}, {"sort=-score&since=" + sinceTS[3], fmt.Sprintf(`"score":-25,"vote":0,"time":%q}],"info":{"count":4`, formattedTS[8])}, - {"sort=-score&url=test-url&since=" + sinceTS[3], fmt.Sprintf(`"score":-2,"vote":0,"controversy":1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":3`, formattedTS[6])}, - {"sort=+controversy&url=test-url&since=" + sinceTS[5], fmt.Sprintf(`"score":-2,"vote":0,"controversy":1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":1`, formattedTS[6])}, + {"sort=-score&url=test-url&since=" + sinceTS[3], fmt.Sprintf(`"score":-2,"vote":0,"controversy":v1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":3`, formattedTS[6])}, + {"sort=+controversy&url=test-url&since=" + sinceTS[5], fmt.Sprintf(`"score":-2,"vote":0,"controversy":v1.5874010519681994,"time":%q}],"info":{"url":"test-url","count":1`, formattedTS[6])}, // three comments of which last one deleted and doesn't have controversy so returned last {"sort=-controversy&url=test-url&since=" + sinceTS[5], fmt.Sprintf(`"score":0,"vote":0,"time":%q,"delete":true}],"info":{"url":"test-url","count":1`, formattedTS[7])}, // test readonly status for the post without comments