Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix depguard lint by adding explicit deny list #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ stages:
- deploy

lint:
image: golangci/golangci-lint:v1.51.0
image: golangci/golangci-lint:v1.59.1
stage: test
before_script:
- cp .env.testing.gitlab-ci .env.testing
Expand Down
41 changes: 26 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ linters-settings:
- opinionated
- performance
- style
enable-checks:
enabled-checks:
- whyNoLint
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
gocyclo:
min-complexity: 15
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
revive:
confidence: 0
mnd:
checks:
# don't include the "operation" and "assign"
- argument
- case
- condition
- return
govet:
check-shadowing: true
settings:
printf:
funcs:
Expand All @@ -38,12 +39,19 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
nolint:
nolintlint:
require-explanation: true
depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax # allow unless explicitly denied
deny:
- pkg: io/ioutil
desc: "Replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "Deprecated: error wrapping available in standard library since Go 1.13"

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
Expand All @@ -63,7 +71,7 @@ linters:
- gofmt
- goimports
- revive
- gomnd
- mnd
- goprintffuncname
- gosec
- gosimple
Expand All @@ -89,9 +97,12 @@ linters:
# - prealloc

run:
skip-dirs:
tests: false

issues:
exclude-dirs:
- tests
- migrations/list

service:
golangci-lint-version: 1.51.0
golangci-lint-version: 1.59.1
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
lint_docker_compose_file = "./development/golangci_lint/docker-compose.yml"

lint-build:
@echo "🌀 ️container are building..."
@echo "🌀 ️container is building..."
@docker-compose --file=$(lint_docker_compose_file) build -q
@echo "✔ ️container built"

lint-check:
@echo "🌀️ code linting..."
@docker-compose --file=$(lint_docker_compose_file) run --rm echo-golinter golangci-lint run \
@docker-compose --file=$(lint_docker_compose_file) run --rm echo-golinter golangci-lint version && golangci-lint run \
&& echo "✔️ checked without errors" \
|| echo "☢️ code style issues found"

Expand Down
2 changes: 1 addition & 1 deletion development/golangci_lint/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golangci/golangci-lint:v1.54.2
FROM golangci/golangci-lint:v1.59.1

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion server/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func ConfigureRoutes(server *s.Server) {
r := server.Echo.Group("")
// Configure middleware with the custom claims type
config := echojwt.Config{
NewClaimsFunc: func(c echo.Context) jwt.Claims {
NewClaimsFunc: func(_ echo.Context) jwt.Claims {
return new(token.JwtCustomClaims)
},
SigningKey: []byte(server.Config.Auth.AccessSecret),
Expand Down
Loading