Skip to content

Commit

Permalink
Update deps and golangci-lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
nezorflame committed Mar 23, 2024
1 parent c67c2bb commit f5a7b0d
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 46 deletions.
118 changes: 77 additions & 41 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,109 @@
# More info on config here: https://github.com/golangci/golangci-lint#config-file
run:
deadline: 10m
timeout: 10m
issues-exit-code: 1
tests: true
skip-dirs:
- bin
- vendor
- var
- tmp
- internal/generated

output:
format: colored-line-number
formats:
- format: json
path: stderr
- format: checkstyle
path: report.xml
- format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters-settings:
gocritic:
disabled-checks:
- exitAfterDefer
goconst:
min-len: 2
min-occurrences: 2
govet:
check-shadowing: true
dupl:
threshold: 100
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
- name: var-naming
disabled: true
gomodguard:
blocked:
modules:
- github.com/pkg/errors:
recommendations:
- errors
reason: "`errors` is the official error helper library."
- github.com/go-errors/errors:
recommendations:
- errors
reason: "`errors` is the official error helper library."
local_replace_directives: true

gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/nezorflame/example-telegram-bot) # Custom section: groups all imports with the specified Prefix.
# - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
# - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
skip-generated: false
custom-order: true
gofumpt:
module-path: github.com/nezorflame/example-telegram-bot
extra-rules: true

linters:
disable-all: true
enable:
- revive
- govet
- errcheck
- ineffassign
- typecheck
- errorlint
- gocheckcompilerdirectives
- goconst
- gocritic
- gomodguard
- gosec
- goimports
- gosimple
- unused
- staticcheck
- govet
- ineffassign
- makezero
- whitespace
# - dupl # - it's very slow, enable if you really know why you need it
- nilnil
- nolintlint
- revive
- staticcheck
- tenv
- thelper
- tparallel
- typecheck
- unconvert
- unused
- usestdlibvars
- wastedassign
- gci # autofixable
- gofumpt # autofixable
- misspell # autofixable
- whitespace # autofixable
# - godox # enable before pushing to avoid TODOs

issues:
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false
# Which dirs to exclude: issues from them won't be reported.
# Can use regexp here: `generated.*`, regexp is applied on full path,
# including the path prefix if one is set.
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-dirs:
- bin
- vendor
- var
- tmp
- internal/generated
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
# _ instead of err checks
- G104
# Close() on types - make sure to know when it's OK to ignore!
- G307
# for "public interface + private struct implementation" cases only!
- "unexported-return: exported func .* returns unexported type .*, which can be annoying to use"
# can be removed in the development phase
- (comment on exported (method|function|type|const|var)|should have( a package)? comment|comment should be of the form)
# not for the active development - can be removed in the stable phase
- should have a package comment, unless it's in another file for this package
- don't use an underscore in package name
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- should check returned error before deferring
- "Error return value of `.*(Close|Remove)` is not checked"
- "string `test` has * occurrences, make it a constant"
# error shadowing is mostly OK
- 'shadow: declaration of "err"'
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
)

require (
github.com/stretchr/testify v1.8.4 // indirect
github.com/stretchr/testify v1.9.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
8 changes: 5 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -507,6 +508,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -585,8 +587,8 @@ golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down

0 comments on commit f5a7b0d

Please sign in to comment.