2
0

Обновлена среда сборки.
All checks were successful
test / test (push) Successful in 56s

This commit is contained in:
Алексей Бадяев 2025-04-22 17:59:14 +07:00
parent 761f8386e7
commit 192724f3b8
Signed by: alexey
GPG Key ID: 686FBC1363E4AFAE
5 changed files with 108 additions and 248 deletions

View File

@ -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

View File

@ -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. cyclop:
# Default: false max-complexity: 20
enable-all: false funlen:
lines: 80
# Enable only fast linters from enabled linters set (first run won't be fast) statements: 50
# Default: false ignore-comments: true
fast: true gocognit:
min-complexity: 20
# All available settings of specific linters. gocyclo:
linters-settings: min-complexity: 20
cyclop: godot:
# The maximal code complexity to report. scope: all
# Default: 10 exclude:
max-complexity: 20 - '^fixme:'
# Should ignore tests. - '^todo:'
# Default: false capital: true
skip-tests: true period: false
gosec:
funlen: excludes:
# Checks the number of lines in a function. - G115
# If lower than 0, disable the check. revive:
# Default: 60 rules:
lines: 80 - name: unexported-return
# Checks the number of statements in a function. disabled: true
# If lower than 0, disable the check. varnamelen:
# Default: 40 max-distance: 6
statements: 50 min-name-length: 2
# Ignore comments when counting lines. ignore-names:
# Default false - err
ignore-comments: true ignore-type-assert-ok: true
ignore-map-index-ok: true
gocognit: ignore-chan-recv-ok: true
# Minimal code complexity to report. exclusions:
# Default: 30 (but we recommend 10-20) generated: lax
min-complexity: 20 presets:
- comments
gocyclo: - common-false-positives
# Minimal code complexity to report. - legacy
# Default: 30 (but we recommend 10-20) - std-error-handling
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:
rules: rules:
- name: unexported-return - linters:
disabled: true - cyclop
path: (.+)_test\.go
varnamelen: paths:
# The longest distance, in source lines, that is being considered a "small scope". - third_party$
# Variables used in at most this many lines will be ignored. - builtin$
# Default: 5 - examples$
max-distance: 6 formatters:
# The minimum length of a variable's name that is considered "long". enable:
# Variable names that are at least this long will be ignored. - gci
# Default: 3 - gofmt
min-name-length: 2 - gofumpt
# Ignore "ok" variables that hold the bool return value of a type assertion. - goimports
# Default: false settings:
ignore-type-assert-ok: true goimports:
# Ignore "ok" variables that hold the bool return value of a map index. local-prefixes:
# Default: false - git.mousesoft.ru/ms/config
ignore-map-index-ok: true exclusions:
# Ignore "ok" variables that hold the bool return value of a channel receive. generated: lax
# Default: false paths:
ignore-chan-recv-ok: true - third_party$
# Optional list of variable names that should be ignored completely. - builtin$
# Default: [] - examples$
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

10
cspell.config.yaml Normal file
View File

@ -0,0 +1,10 @@
version: "0.2"
ignorePaths: []
dictionaryDefinitions: []
dictionaries: []
words: []
ignoreWords:
- davecgh
- difflib
- pmezard
import: []

2
go.mod
View File

@ -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

View File

@ -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}"