This commit is contained in:
parent
761f8386e7
commit
192724f3b8
@ -15,7 +15,7 @@ jobs:
|
||||
- name: set-up go
|
||||
uses: https://gitea.com/actions/setup-go@v3
|
||||
with:
|
||||
go-version: ">=1.22"
|
||||
go-version: ">=1.24"
|
||||
|
||||
- name: set-up dependencies
|
||||
run: |
|
||||
@ -29,9 +29,9 @@ jobs:
|
||||
run: make lint
|
||||
|
||||
- name: golangci-lint
|
||||
uses: https://github.com/golangci/golangci-lint-action@v6
|
||||
uses: https://github.com/golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: v1.60
|
||||
version: v2.0.2
|
||||
|
||||
- name: test
|
||||
id: build
|
||||
|
329
.golangci.yaml
329
.golangci.yaml
@ -1,15 +1,27 @@
|
||||
# This file contains all available configuration options
|
||||
# with their default values (in comments).
|
||||
#
|
||||
# This file is not a configuration example,
|
||||
# it contains the exhaustive configuration with explanations of the options.
|
||||
|
||||
version: "2"
|
||||
run:
|
||||
concurrency: 4
|
||||
go: "1.22"
|
||||
build-tags:
|
||||
- mytag
|
||||
modules-download-mode: readonly
|
||||
issues-exit-code: 2
|
||||
tests: false
|
||||
allow-parallel-runners: true
|
||||
allow-serial-runners: true
|
||||
output:
|
||||
formats:
|
||||
text:
|
||||
path: stdout
|
||||
print-linter-name: true
|
||||
print-issued-lines: false
|
||||
sort-order:
|
||||
- linter
|
||||
- severity
|
||||
- file
|
||||
path-prefix: ""
|
||||
linters:
|
||||
# Disable all linters.
|
||||
# Default: false
|
||||
disable-all: true
|
||||
# Enable specific linter
|
||||
# https://golangci-lint.run/usage/linters/#enabled-by-default
|
||||
default: none
|
||||
enable:
|
||||
- asasalint
|
||||
- asciicheck
|
||||
@ -30,14 +42,11 @@ linters:
|
||||
- errchkjson
|
||||
- errname
|
||||
- errorlint
|
||||
# - exhaustive
|
||||
- fatcontext
|
||||
- forcetypeassert
|
||||
- funlen
|
||||
- gci
|
||||
- ginkgolinter
|
||||
- gocheckcompilerdirectives
|
||||
# - gochecknoglobals
|
||||
- gochecknoinits
|
||||
- gochecksumtype
|
||||
- gocognit
|
||||
@ -46,15 +55,11 @@ linters:
|
||||
- gocyclo
|
||||
- godot
|
||||
- godox
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goheader
|
||||
- goimports
|
||||
- gomoddirectives
|
||||
- gomodguard
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- gosmopolitan
|
||||
- govet
|
||||
- grouper
|
||||
@ -64,7 +69,6 @@ linters:
|
||||
- interfacebloat
|
||||
- intrange
|
||||
- ireturn
|
||||
# - lll
|
||||
- loggercheck
|
||||
- maintidx
|
||||
- makezero
|
||||
@ -94,10 +98,7 @@ linters:
|
||||
- spancheck
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- stylecheck
|
||||
# - tagalign
|
||||
- tagliatelle
|
||||
- tenv
|
||||
- testableexamples
|
||||
- testifylint
|
||||
- testpackage
|
||||
@ -113,225 +114,67 @@ linters:
|
||||
- wrapcheck
|
||||
- wsl
|
||||
- zerologlint
|
||||
|
||||
# Enable all available linters.
|
||||
# Default: false
|
||||
enable-all: false
|
||||
|
||||
# Enable only fast linters from enabled linters set (first run won't be fast)
|
||||
# Default: false
|
||||
fast: true
|
||||
|
||||
# All available settings of specific linters.
|
||||
linters-settings:
|
||||
cyclop:
|
||||
# The maximal code complexity to report.
|
||||
# Default: 10
|
||||
max-complexity: 20
|
||||
# Should ignore tests.
|
||||
# Default: false
|
||||
skip-tests: true
|
||||
|
||||
funlen:
|
||||
# Checks the number of lines in a function.
|
||||
# If lower than 0, disable the check.
|
||||
# Default: 60
|
||||
lines: 80
|
||||
# Checks the number of statements in a function.
|
||||
# If lower than 0, disable the check.
|
||||
# Default: 40
|
||||
statements: 50
|
||||
# Ignore comments when counting lines.
|
||||
# Default false
|
||||
ignore-comments: true
|
||||
|
||||
gocognit:
|
||||
# Minimal code complexity to report.
|
||||
# Default: 30 (but we recommend 10-20)
|
||||
min-complexity: 20
|
||||
|
||||
gocyclo:
|
||||
# Minimal code complexity to report.
|
||||
# Default: 30 (but we recommend 10-20)
|
||||
min-complexity: 20
|
||||
|
||||
godot:
|
||||
# Comments to be checked: `declarations`, `toplevel`, or `all`.
|
||||
# Default: declarations
|
||||
scope: all
|
||||
# List of regexps for excluding particular comment lines from check.
|
||||
# Default: []
|
||||
exclude:
|
||||
# Exclude todo and fixme comments.
|
||||
- "^fixme:"
|
||||
- "^todo:"
|
||||
# Check that each sentence ends with a period.
|
||||
# Default: true
|
||||
period: false
|
||||
# Check that each sentence starts with a capital letter.
|
||||
# Default: false
|
||||
capital: true
|
||||
|
||||
goimports:
|
||||
local-prefixes: git.mousesoft.ru/ms/config
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
|
||||
revive:
|
||||
settings:
|
||||
cyclop:
|
||||
max-complexity: 20
|
||||
funlen:
|
||||
lines: 80
|
||||
statements: 50
|
||||
ignore-comments: true
|
||||
gocognit:
|
||||
min-complexity: 20
|
||||
gocyclo:
|
||||
min-complexity: 20
|
||||
godot:
|
||||
scope: all
|
||||
exclude:
|
||||
- '^fixme:'
|
||||
- '^todo:'
|
||||
capital: true
|
||||
period: false
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
revive:
|
||||
rules:
|
||||
- name: unexported-return
|
||||
disabled: true
|
||||
varnamelen:
|
||||
max-distance: 6
|
||||
min-name-length: 2
|
||||
ignore-names:
|
||||
- err
|
||||
ignore-type-assert-ok: true
|
||||
ignore-map-index-ok: true
|
||||
ignore-chan-recv-ok: true
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
rules:
|
||||
- name: unexported-return
|
||||
disabled: true
|
||||
|
||||
varnamelen:
|
||||
# The longest distance, in source lines, that is being considered a "small scope".
|
||||
# Variables used in at most this many lines will be ignored.
|
||||
# Default: 5
|
||||
max-distance: 6
|
||||
# The minimum length of a variable's name that is considered "long".
|
||||
# Variable names that are at least this long will be ignored.
|
||||
# Default: 3
|
||||
min-name-length: 2
|
||||
# Ignore "ok" variables that hold the bool return value of a type assertion.
|
||||
# Default: false
|
||||
ignore-type-assert-ok: true
|
||||
# Ignore "ok" variables that hold the bool return value of a map index.
|
||||
# Default: false
|
||||
ignore-map-index-ok: true
|
||||
# Ignore "ok" variables that hold the bool return value of a channel receive.
|
||||
# Default: false
|
||||
ignore-chan-recv-ok: true
|
||||
# Optional list of variable names that should be ignored completely.
|
||||
# Default: []
|
||||
ignore-names:
|
||||
- err
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# The formats used to render issues.
|
||||
# Formats:
|
||||
# - `colored-line-number`
|
||||
# - `line-number`
|
||||
# - `json`
|
||||
# - `colored-tab`
|
||||
# - `tab`
|
||||
# - `html`
|
||||
# - `checkstyle`
|
||||
# - `code-climate`
|
||||
# - `junit-xml`
|
||||
# - `junit-xml-extended`
|
||||
# - `github-actions`
|
||||
# - `teamcity`
|
||||
# - `sarif`
|
||||
# Output path can be either `stdout`, `stderr` or path to the file to write to.
|
||||
#
|
||||
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
|
||||
# The output can be specified for each of them by separating format name and path by colon symbol.
|
||||
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
|
||||
# The CLI flag (`--out-format`) override the configuration file.
|
||||
#
|
||||
# Default:
|
||||
# formats:
|
||||
# - format: colored-line-number
|
||||
# path: stdout
|
||||
formats:
|
||||
# - format: json
|
||||
# path: stderr
|
||||
# - format: checkstyle
|
||||
# path: report.xml
|
||||
- format: colored-line-number
|
||||
|
||||
# Print lines of code with issue.
|
||||
# Default: true
|
||||
print-issued-lines: false
|
||||
|
||||
# Print linter name in the end of issue text.
|
||||
# Default: true
|
||||
print-linter-name: true
|
||||
|
||||
# Make issues output unique by line.
|
||||
# Default: true
|
||||
uniq-by-line: false
|
||||
|
||||
# Add a prefix to the output file references.
|
||||
# Default: ""
|
||||
path-prefix: ""
|
||||
|
||||
# Sort results by the order defined in `sort-order`.
|
||||
# Default: false
|
||||
sort-results: true
|
||||
|
||||
# Order to use when sorting results.
|
||||
# Require `sort-results` to `true`.
|
||||
# Possible values: `file`, `linter`, and `severity`.
|
||||
#
|
||||
# If the severity values are inside the following list, they are ordered in this order:
|
||||
# 1. error
|
||||
# 2. warning
|
||||
# 3. high
|
||||
# 4. medium
|
||||
# 5. low
|
||||
# Either they are sorted alphabetically.
|
||||
#
|
||||
# Default: ["file"]
|
||||
sort-order:
|
||||
- linter
|
||||
- severity
|
||||
- file # filepath, line, and column.
|
||||
|
||||
# Show statistics per linter.
|
||||
# Default: false
|
||||
show-stats: true
|
||||
|
||||
# Options for analysis running.
|
||||
run:
|
||||
# Timeout for analysis, e.g. 30s, 5m.
|
||||
# Default: 1m
|
||||
timeout: 5m
|
||||
|
||||
# Exit code when at least one issue was found.
|
||||
# Default: 1
|
||||
issues-exit-code: 2
|
||||
|
||||
# Include test files or not.
|
||||
# Default: true
|
||||
tests: false
|
||||
|
||||
# List of build tags, all linters use it.
|
||||
# Default: []
|
||||
build-tags:
|
||||
- mytag
|
||||
|
||||
# If set, we pass it to "go list -mod={option}". From "go help modules":
|
||||
# If invoked with -mod=readonly, the go command is disallowed from the implicit
|
||||
# automatic updating of go.mod described above. Instead, it fails when any changes
|
||||
# to go.mod are needed. This setting is most useful to check that go.mod does
|
||||
# not need updates, such as in a continuous integration and testing system.
|
||||
# If invoked with -mod=vendor, the go command assumes that the vendor
|
||||
# directory holds the correct copies of dependencies and ignores
|
||||
# the dependency descriptions in go.mod.
|
||||
#
|
||||
# Allowed values: readonly|vendor|mod
|
||||
# Default: ""
|
||||
modules-download-mode: readonly
|
||||
|
||||
# Allow multiple parallel golangci-lint instances running.
|
||||
# If false, golangci-lint acquires file lock on start.
|
||||
# Default: false
|
||||
allow-parallel-runners: true
|
||||
|
||||
# Allow multiple golangci-lint instances running, but serialize them around a lock.
|
||||
# If false, golangci-lint exits with an error if it fails to acquire file lock on start.
|
||||
# Default: false
|
||||
allow-serial-runners: true
|
||||
|
||||
# Define the Go version limit.
|
||||
# Mainly related to generics support since go1.18.
|
||||
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
|
||||
go: "1.22"
|
||||
|
||||
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
|
||||
# If it is explicitly set to 0 (i.e. not the default) then golangci-lint will automatically set the value to match Linux container CPU quota.
|
||||
# Default: the number of logical CPUs in the machine
|
||||
concurrency: 4
|
||||
- linters:
|
||||
- cyclop
|
||||
path: (.+)_test\.go
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
enable:
|
||||
- gci
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
settings:
|
||||
goimports:
|
||||
local-prefixes:
|
||||
- git.mousesoft.ru/ms/config
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
10
cspell.config.yaml
Normal file
10
cspell.config.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
version: "0.2"
|
||||
ignorePaths: []
|
||||
dictionaryDefinitions: []
|
||||
dictionaries: []
|
||||
words: []
|
||||
ignoreWords:
|
||||
- davecgh
|
||||
- difflib
|
||||
- pmezard
|
||||
import: []
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module git.mousesoft.ru/ms/config
|
||||
|
||||
go 1.22
|
||||
go 1.24
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.9.0
|
||||
|
9
makefile
9
makefile
@ -85,11 +85,18 @@ lint: ## Run all available linters.
|
||||
go vet ./...
|
||||
errcheck ./...
|
||||
staticcheck ./...
|
||||
usestdlibvars ./...
|
||||
# usestdlibvars ./...
|
||||
shadow ./...
|
||||
@$(ECHO_CMD) "Lint\t\t${GREEN}[OK]${RESET}"
|
||||
.PHONY:lint
|
||||
|
||||
GOLANGCI_URL := https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
|
||||
GOLANGCI_VERSION := v2.0.2
|
||||
|
||||
golangci-lint-install: ## Install golangci-lint util
|
||||
curl -sfL ${GOLANGCI_URL} | sh -s -- -b ${GOPATH}/bin ${GOLANGCI_VERSION}
|
||||
.PHONY:lint-golangci-install
|
||||
|
||||
golangci-lint: ## Run golangci-lint linter
|
||||
@golangci-lint run
|
||||
@$(ECHO_CMD) "GolangCI Lint\t${GREEN}[OK]${RESET}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user