From bb172aea71f3c92fcc1a7301f10541a648ebc1c1 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Fri, 15 May 2020 21:27:15 +0530 Subject: [PATCH] MM-25007: Add staticcheck (#14522) --- .golangci.yml | 5 +++++ app/audit.go | 1 - app/emoji.go | 2 +- app/file.go | 3 +-- app/user.go | 2 +- i18n/en.json | 4 ++++ 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3310ed41cc..a846446ca6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,7 @@ linters: - ineffassign - scopelint - structcheck + - staticcheck - unconvert - unused - varcheck @@ -41,6 +42,10 @@ issues: # ignore warnings from table tests. https://github.com/kyoh86/scopelint/issues/4 path: ".*_test.go|store/storetest" + - linters: + - staticcheck + path: ".*_test.go|store/storetest" + - linters: # ignore golint error for a lot of packages for now - golint diff --git a/app/audit.go b/app/audit.go index 9d00eaeebe..9345b0781d 100644 --- a/app/audit.go +++ b/app/audit.go @@ -136,7 +136,6 @@ func (s *Server) configureAudit(adt *audit.Audit) { filter := adt.MakeFilter(RestLevel, RestContentLevel, RestPermsLevel, CLILevel) formatter := adt.MakeJSONFormatter() formatter.DisableTimestamp = false - formatter.Indent = "\n" target, err := audit.NewFileTarget(filter, formatter, opts, maxQueueSize) if err != nil { mlog.Error("cannot configure File audit target", mlog.Err(err)) diff --git a/app/emoji.go b/app/emoji.go index 4dd79ef650..bdc60c5789 100644 --- a/app/emoji.go +++ b/app/emoji.go @@ -278,7 +278,7 @@ func resizeEmoji(img image.Image, width int, height int) image.Image { func imageToPaletted(img image.Image) *image.Paletted { b := img.Bounds() pm := image.NewPaletted(b, palette.Plan9) - draw.FloydSteinberg.Draw(pm, b, img, image.ZP) + draw.FloydSteinberg.Draw(pm, b, img, image.Point{}) return pm } diff --git a/app/file.go b/app/file.go index e9978cd598..5be9636b46 100644 --- a/app/file.go +++ b/app/file.go @@ -330,8 +330,7 @@ func (a *App) MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo { } // Copy and save the updated post - newPost := &model.Post{} - newPost = post.Clone() + newPost := post.Clone() newPost.Filenames = []string{} newPost.FileIds = fileIds diff --git a/app/user.go b/app/user.go index d0633ba366..d94899f0a1 100644 --- a/app/user.go +++ b/app/user.go @@ -709,7 +709,7 @@ func CreateProfileImage(username string, userId string, initialFont string) ([]b color := colors[int64(seed)%int64(len(colors))] dstImg := image.NewRGBA(image.Rect(0, 0, IMAGE_PROFILE_PIXEL_DIMENSION, IMAGE_PROFILE_PIXEL_DIMENSION)) srcImg := image.White - draw.Draw(dstImg, dstImg.Bounds(), &image.Uniform{color}, image.ZP, draw.Src) + draw.Draw(dstImg, dstImg.Bounds(), &image.Uniform{color}, image.Point{}, draw.Src) size := float64(IMAGE_PROFILE_PIXEL_DIMENSION / 2) c := freetype.NewContext() diff --git a/i18n/en.json b/i18n/en.json index 3c8b425ab3..966a3981c6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -3886,6 +3886,10 @@ "id": "ent.compliance.csv.metadata.json.marshalling.appError", "translation": "Unable to convert metadata to json." }, + { + "id": "ent.compliance.csv.metadata.json.zipfile.appError", + "translation": "Unable to create the zip file" + }, { "id": "ent.compliance.csv.post.export.appError", "translation": "Unable to export a post."