From 2cc26ffbd74b5232dbb13b264f70e9b5119245ea Mon Sep 17 00:00:00 2001 From: Nick Lupton <19624419+mr-nick17@users.noreply.github.com> Date: Wed, 10 May 2023 09:26:17 +0100 Subject: [PATCH] 1599 update and fix linter --- .golangci.yml | 8 ++++---- Makefile | 3 ++- handlers/feedback.go | 4 ++-- main.go | 2 +- mocks/mocks.go | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 92ff7fe..a184b86 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,7 +50,6 @@ linters: # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint disable-all: true enable: - - deadcode - depguard - dogsled - gochecknoinits @@ -64,7 +63,6 @@ linters: - ineffassign - nakedret - unconvert - - varcheck - whitespace - gocognit - prealloc @@ -82,12 +80,14 @@ issues: - gocritic - ineffassign - govet + - path: main.go + linters: - typecheck new: false # golangci.com configuration # https://github.com/golangci/golangci/wiki/Configuration service: - golangci-lint-version: 1.43.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.52.x # use the fixed version to not introduce new linters unexpectedly prepare: - - echo "here I can run custom commands, but no preparation needed for this repo" \ No newline at end of file + - echo "here I can run custom commands, but no preparation needed for this repo" diff --git a/Makefile b/Makefile index b866b02..20cfa24 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,9 @@ audit: build: generate-prod go build -tags 'production' $(LDFLAGS) -o $(BINPATH)/dp-frontend-feedback-controller +.PHONY: lint lint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 golangci-lint run ./... .PHONY: debug diff --git a/handlers/feedback.go b/handlers/feedback.go index 43ae3f5..e67d349 100644 --- a/handlers/feedback.go +++ b/handlers/feedback.go @@ -28,7 +28,7 @@ func (f *Feedback) FeedbackThanks() http.HandlerFunc { }) } -func feedbackThanks(w http.ResponseWriter, req *http.Request, url string, rend interfaces.Renderer, cacheHelperService *cacheHelper.Helper, lang string) { +func feedbackThanks(w http.ResponseWriter, req *http.Request, uri string, rend interfaces.Renderer, cacheHelperService *cacheHelper.Helper, lang string) { ctx := req.Context() var wholeSite string @@ -40,7 +40,7 @@ func feedbackThanks(w http.ResponseWriter, req *http.Request, url string, rend i } basePage := rend.NewBasePageModel() - p := mapper.CreateGetFeedbackThanks(req, basePage, lang, url, wholeSite) + p := mapper.CreateGetFeedbackThanks(req, basePage, lang, uri, wholeSite) if cfg.EnableNewNavBar { mappedNavContent, err := cacheHelperService.GetMappedNavigationContent(ctx, lang) diff --git a/main.go b/main.go index 21d0a72..e5f5c70 100644 --- a/main.go +++ b/main.go @@ -69,7 +69,7 @@ func main() { cacheService, err := cacheHelper.Init(ctx, cacheConfig) cacheService.RunUpdates(ctx, svcErrors) - // nolint: typecheck + //nolint:typecheck rend := render.NewWithDefaultClient(assets.Asset, assets.AssetNames, cfg.PatternLibraryAssetsPath, cfg.SiteDomain) routes.Setup(ctx, r, cfg, rend, healthcheck, cacheService) diff --git a/mocks/mocks.go b/mocks/mocks.go index fc52744..53c8c2f 100644 --- a/mocks/mocks.go +++ b/mocks/mocks.go @@ -17,6 +17,6 @@ var enLocale = []string{ } // MockAssetFunction returns mocked toml []bytes -func MockAssetFunction(name string) ([]byte, error) { +func MockAssetFunction(name string) ([]byte, error) { //nolint:all // app does not use welsh return []byte(strings.Join(enLocale, "\n")), nil }