diff --git a/.golangci.yml b/.golangci.yml index f74fe90d5..86d4978aa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -76,7 +76,7 @@ linters-settings: # path to a file containing a list of functions to exclude from checking # see https://github.com/kisielk/errcheck#excluding-functions for details - exclude: /path/to/file.txt + #exclude: /path/to/file.txt govet: # report about shadowed variables check-shadowing: true @@ -163,28 +163,28 @@ linters-settings: #enabled-checks: # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty - disabled-checks: - - regexpMust + #disabled-checks: # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". - enabled-tags: - - performance + #enabled-tags: + # - performance settings: # settings passed to gocritic captLocal: # must be valid enabled check name paramsOnly: true - rangeValCopy: - sizeThreshold: 32 + #rangeValCopy: + # sizeThreshold: 32 linters: enable: - megacheck - - govet enable-all: false disable: - maligned - prealloc + - gosec + - scopelint disable-all: false presets: - bugs @@ -248,7 +248,7 @@ issues: new: false # Show only new issues created after git revision `REV` - new-from-rev: REV + #new-from-rev: REV # Show only new issues created in git patch with set file path. - new-from-patch: path/to/patch/file + #new-from-patch: path/to/patch/file diff --git a/federationapi/routing/state.go b/federationapi/routing/state.go index 130f8a4f7..58398bde9 100644 --- a/federationapi/routing/state.go +++ b/federationapi/routing/state.go @@ -75,7 +75,8 @@ func parseEventIDParam( ) (eventID string, resErr *util.JSONResponse) { URL, err := url.Parse(request.RequestURI()) if err != nil { - *resErr = util.ErrorResponse(err) + response := util.ErrorResponse(err) + resErr = &response return } diff --git a/linter-fast.json b/linter-fast.json deleted file mode 100644 index 68d518444..000000000 --- a/linter-fast.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Vendor": true, - "Cyclo": 12, - "Deadline": "5m", - "Enable": [ - "vetshadow", - "deadcode", - "gocyclo", - "ineffassign", - "misspell", - "errcheck", - "vet", - "gofmt", - "goconst" - ] -} diff --git a/linter.json b/linter.json deleted file mode 100644 index 1f0550aaf..000000000 --- a/linter.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Vendor": true, - "Cyclo": 12, - "Deadline": "5m", - "Enable": [ - "vetshadow", - "deadcode", - "gocyclo", - "golint", - "varcheck", - "structcheck", - "ineffassign", - "misspell", - "unparam", - "errcheck", - "vet", - "gofmt", - "goconst" - ] -} diff --git a/mediaapi/thumbnailer/thumbnailer_nfnt.go b/mediaapi/thumbnailer/thumbnailer_nfnt.go index 43bf8efba..5df6ce4be 100644 --- a/mediaapi/thumbnailer/thumbnailer_nfnt.go +++ b/mediaapi/thumbnailer/thumbnailer_nfnt.go @@ -20,9 +20,11 @@ import ( "context" "image" "image/draw" + // Imported for gif codec _ "image/gif" "image/jpeg" + // Imported for png codec _ "image/png" "os" @@ -258,9 +260,6 @@ func adjustSize(dst types.Path, img image.Image, w, h int, crop bool, logger *lo out = target } else { out = resize.Thumbnail(uint(w), uint(h), img, resize.Lanczos3) - if err != nil { - return -1, -1, err - } } if err = writeFile(out, string(dst)); err != nil { diff --git a/scripts/find-lint.sh b/scripts/find-lint.sh index 1cb850dc1..82dbba693 100755 --- a/scripts/find-lint.sh +++ b/scripts/find-lint.sh @@ -29,4 +29,4 @@ echo "Looking for lint..." golangci-lint run $args echo "Checking spelling..." -golangci-lint -E "misspell" ./*.md +misspell -error src *.md diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go index 273b6aea1..1866a9667 100644 --- a/syncapi/consumers/roomserver.go +++ b/syncapi/consumers/roomserver.go @@ -134,10 +134,6 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent( msg.RemovesStateEventIDs, msg.TransactionID, ) - if err != nil { - return err - } - if err != nil { // panic rather than continue with an inconsistent database log.WithFields(log.Fields{ diff --git a/typingserver/cache/cache_test.go b/typingserver/cache/cache_test.go index 7aa73e922..2a6ffa50e 100644 --- a/typingserver/cache/cache_test.go +++ b/typingserver/cache/cache_test.go @@ -38,7 +38,7 @@ func TestTypingCache(t *testing.T) { }) } -func testAddTypingUser(t *testing.T, tCache *TypingCache) { +func testAddTypingUser(t *testing.T, tCache *TypingCache) { // nolint: unparam present := time.Now() tests := []struct { userID string