This commit is contained in:
parent
761f8386e7
commit
192724f3b8
@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: set-up go
|
- name: set-up go
|
||||||
uses: https://gitea.com/actions/setup-go@v3
|
uses: https://gitea.com/actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: ">=1.22"
|
go-version: ">=1.24"
|
||||||
|
|
||||||
- name: set-up dependencies
|
- name: set-up dependencies
|
||||||
run: |
|
run: |
|
||||||
@ -29,9 +29,9 @@ jobs:
|
|||||||
run: make lint
|
run: make lint
|
||||||
|
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: https://github.com/golangci/golangci-lint-action@v6
|
uses: https://github.com/golangci/golangci-lint-action@v7
|
||||||
with:
|
with:
|
||||||
version: v1.60
|
version: v2.0.2
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
id: build
|
id: build
|
||||||
|
279
.golangci.yaml
279
.golangci.yaml
@ -1,15 +1,27 @@
|
|||||||
# This file contains all available configuration options
|
version: "2"
|
||||||
# with their default values (in comments).
|
run:
|
||||||
#
|
concurrency: 4
|
||||||
# This file is not a configuration example,
|
go: "1.22"
|
||||||
# it contains the exhaustive configuration with explanations of the options.
|
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:
|
linters:
|
||||||
# Disable all linters.
|
default: none
|
||||||
# Default: false
|
|
||||||
disable-all: true
|
|
||||||
# Enable specific linter
|
|
||||||
# https://golangci-lint.run/usage/linters/#enabled-by-default
|
|
||||||
enable:
|
enable:
|
||||||
- asasalint
|
- asasalint
|
||||||
- asciicheck
|
- asciicheck
|
||||||
@ -30,14 +42,11 @@ linters:
|
|||||||
- errchkjson
|
- errchkjson
|
||||||
- errname
|
- errname
|
||||||
- errorlint
|
- errorlint
|
||||||
# - exhaustive
|
|
||||||
- fatcontext
|
- fatcontext
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- funlen
|
- funlen
|
||||||
- gci
|
|
||||||
- ginkgolinter
|
- ginkgolinter
|
||||||
- gocheckcompilerdirectives
|
- gocheckcompilerdirectives
|
||||||
# - gochecknoglobals
|
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- gochecksumtype
|
- gochecksumtype
|
||||||
- gocognit
|
- gocognit
|
||||||
@ -46,15 +55,11 @@ linters:
|
|||||||
- gocyclo
|
- gocyclo
|
||||||
- godot
|
- godot
|
||||||
- godox
|
- godox
|
||||||
- gofmt
|
|
||||||
- gofumpt
|
|
||||||
- goheader
|
- goheader
|
||||||
- goimports
|
|
||||||
- gomoddirectives
|
- gomoddirectives
|
||||||
- gomodguard
|
- gomodguard
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- gosimple
|
|
||||||
- gosmopolitan
|
- gosmopolitan
|
||||||
- govet
|
- govet
|
||||||
- grouper
|
- grouper
|
||||||
@ -64,7 +69,6 @@ linters:
|
|||||||
- interfacebloat
|
- interfacebloat
|
||||||
- intrange
|
- intrange
|
||||||
- ireturn
|
- ireturn
|
||||||
# - lll
|
|
||||||
- loggercheck
|
- loggercheck
|
||||||
- maintidx
|
- maintidx
|
||||||
- makezero
|
- makezero
|
||||||
@ -94,10 +98,7 @@ linters:
|
|||||||
- spancheck
|
- spancheck
|
||||||
- sqlclosecheck
|
- sqlclosecheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- stylecheck
|
|
||||||
# - tagalign
|
|
||||||
- tagliatelle
|
- tagliatelle
|
||||||
- tenv
|
|
||||||
- testableexamples
|
- testableexamples
|
||||||
- testifylint
|
- testifylint
|
||||||
- testpackage
|
- testpackage
|
||||||
@ -113,225 +114,67 @@ linters:
|
|||||||
- wrapcheck
|
- wrapcheck
|
||||||
- wsl
|
- wsl
|
||||||
- zerologlint
|
- zerologlint
|
||||||
|
settings:
|
||||||
# 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:
|
cyclop:
|
||||||
# The maximal code complexity to report.
|
|
||||||
# Default: 10
|
|
||||||
max-complexity: 20
|
max-complexity: 20
|
||||||
# Should ignore tests.
|
|
||||||
# Default: false
|
|
||||||
skip-tests: true
|
|
||||||
|
|
||||||
funlen:
|
funlen:
|
||||||
# Checks the number of lines in a function.
|
|
||||||
# If lower than 0, disable the check.
|
|
||||||
# Default: 60
|
|
||||||
lines: 80
|
lines: 80
|
||||||
# Checks the number of statements in a function.
|
|
||||||
# If lower than 0, disable the check.
|
|
||||||
# Default: 40
|
|
||||||
statements: 50
|
statements: 50
|
||||||
# Ignore comments when counting lines.
|
|
||||||
# Default false
|
|
||||||
ignore-comments: true
|
ignore-comments: true
|
||||||
|
|
||||||
gocognit:
|
gocognit:
|
||||||
# Minimal code complexity to report.
|
|
||||||
# Default: 30 (but we recommend 10-20)
|
|
||||||
min-complexity: 20
|
min-complexity: 20
|
||||||
|
|
||||||
gocyclo:
|
gocyclo:
|
||||||
# Minimal code complexity to report.
|
|
||||||
# Default: 30 (but we recommend 10-20)
|
|
||||||
min-complexity: 20
|
min-complexity: 20
|
||||||
|
|
||||||
godot:
|
godot:
|
||||||
# Comments to be checked: `declarations`, `toplevel`, or `all`.
|
|
||||||
# Default: declarations
|
|
||||||
scope: all
|
scope: all
|
||||||
# List of regexps for excluding particular comment lines from check.
|
|
||||||
# Default: []
|
|
||||||
exclude:
|
exclude:
|
||||||
# Exclude todo and fixme comments.
|
- '^fixme:'
|
||||||
- "^fixme:"
|
- '^todo:'
|
||||||
- "^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
|
capital: true
|
||||||
|
period: false
|
||||||
goimports:
|
|
||||||
local-prefixes: git.mousesoft.ru/ms/config
|
|
||||||
|
|
||||||
gosec:
|
gosec:
|
||||||
excludes:
|
excludes:
|
||||||
- G115
|
- G115
|
||||||
|
|
||||||
revive:
|
revive:
|
||||||
rules:
|
rules:
|
||||||
- name: unexported-return
|
- name: unexported-return
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
varnamelen:
|
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
|
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
|
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:
|
ignore-names:
|
||||||
- err
|
- err
|
||||||
|
ignore-type-assert-ok: true
|
||||||
# output configuration options
|
ignore-map-index-ok: true
|
||||||
output:
|
ignore-chan-recv-ok: true
|
||||||
# The formats used to render issues.
|
exclusions:
|
||||||
# Formats:
|
generated: lax
|
||||||
# - `colored-line-number`
|
presets:
|
||||||
# - `line-number`
|
- comments
|
||||||
# - `json`
|
- common-false-positives
|
||||||
# - `colored-tab`
|
- legacy
|
||||||
# - `tab`
|
- std-error-handling
|
||||||
# - `html`
|
rules:
|
||||||
# - `checkstyle`
|
- linters:
|
||||||
# - `code-climate`
|
- cyclop
|
||||||
# - `junit-xml`
|
path: (.+)_test\.go
|
||||||
# - `junit-xml-extended`
|
paths:
|
||||||
# - `github-actions`
|
- third_party$
|
||||||
# - `teamcity`
|
- builtin$
|
||||||
# - `sarif`
|
- examples$
|
||||||
# Output path can be either `stdout`, `stderr` or path to the file to write to.
|
formatters:
|
||||||
#
|
enable:
|
||||||
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
|
- gci
|
||||||
# The output can be specified for each of them by separating format name and path by colon symbol.
|
- gofmt
|
||||||
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
|
- gofumpt
|
||||||
# The CLI flag (`--out-format`) override the configuration file.
|
- goimports
|
||||||
#
|
settings:
|
||||||
# Default:
|
goimports:
|
||||||
# formats:
|
local-prefixes:
|
||||||
# - format: colored-line-number
|
- git.mousesoft.ru/ms/config
|
||||||
# path: stdout
|
exclusions:
|
||||||
formats:
|
generated: lax
|
||||||
# - format: json
|
paths:
|
||||||
# path: stderr
|
- third_party$
|
||||||
# - format: checkstyle
|
- builtin$
|
||||||
# path: report.xml
|
- examples$
|
||||||
- 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
|
|
||||||
|
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
|
module git.mousesoft.ru/ms/config
|
||||||
|
|
||||||
go 1.22
|
go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
|
9
makefile
9
makefile
@ -85,11 +85,18 @@ lint: ## Run all available linters.
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
errcheck ./...
|
errcheck ./...
|
||||||
staticcheck ./...
|
staticcheck ./...
|
||||||
usestdlibvars ./...
|
# usestdlibvars ./...
|
||||||
shadow ./...
|
shadow ./...
|
||||||
@$(ECHO_CMD) "Lint\t\t${GREEN}[OK]${RESET}"
|
@$(ECHO_CMD) "Lint\t\t${GREEN}[OK]${RESET}"
|
||||||
.PHONY:lint
|
.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 golangci-lint linter
|
||||||
@golangci-lint run
|
@golangci-lint run
|
||||||
@$(ECHO_CMD) "GolangCI Lint\t${GREEN}[OK]${RESET}"
|
@$(ECHO_CMD) "GolangCI Lint\t${GREEN}[OK]${RESET}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user