Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:

steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
cache-dependency-path: ./go.sum

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: v1.64.5
version: v2.11.4
working-directory: ./

- name: Install dependencies
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: deploy to ghcr.io

on:
workflow_run:
workflows: ["audit"]
types: [completed]
tags:
- "*"
push:
# run only against tags
tags:
- "*"

permissions:
contents: write
packages: write

jobs:
push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Fetch tags
run: git fetch --force --tags
Expand All @@ -23,7 +28,7 @@ jobs:
run: echo ${{github.ref_name}}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{github.actor}}
Expand Down
261 changes: 116 additions & 145 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,8 @@
version: "2"
run:
concurrency: 4
timeout: 5m

linters:
disable-all:
true
# Disabled linters:
# canonicalheader
# decorder
# dupword
# err113
# exhaustruct
# forbidigo
# forcetypeassert # заменён на errcheck
# funlen
# ginkgolinter
# gofmt # заменён на goimports
# gofumpt # заменён на goimports
# goheader
# gomoddirectives
# gomodguard # используется более мощный depguard
# gosmopolitan
# grouper
# interfacebloat
# intrange
# ireturn
# lll
# loggercheck
# mirror
# misspell # бесполезный
# nonamedreturns
# nlreturn # слишком строгий и в основном код не более читабелен
# paralleltest # слишком много ложных срабатываний
# protogetter
# sloglint
# spancheck
# sqlclosecheck
# tagalign
# tenv # заменён на usetesting.os-setenv: true
# testableexamples
# testpackage
# varnamelen
# wastedassign
# wsl # слишком строгий и в основном код не более читабелен
# zerologlint
default: none
enable:
- asasalint
- asciicheck
Expand All @@ -64,7 +23,6 @@ linters:
- exhaustive
- exptostd
- fatcontext
- gci
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
Expand All @@ -75,18 +33,18 @@ linters:
- gocyclo
- godot
- godox
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- iface
- importas
- inamedparam
- ineffassign
- iotamixing
- maintidx
- makezero
- mnd # https://golangci-lint.run/usage/linters/#mnd
- mnd
- modernize
- musttag
- nakedret
- nestif
Expand All @@ -105,115 +63,128 @@ linters:
- revive
- rowserrcheck
- staticcheck
- stylecheck
- tagliatelle
- testifylint
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- whitespace
- wrapcheck

linters-settings:
cyclop:
max-complexity: 15
skip-tests: true
depguard:
rules:
main:
list-mode: lax
deny:
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package
- pkg: "github.com/golang/protobuf"
desc: "Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
errcheck:
check-type-assertions: true
errorlint:
errorf: false
exhaustive:
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
default-signifies-exhaustive: true
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
explicit-exhaustive-switch: true
gci:
sections:
- standard
- default
- prefix(geeksonator)
gocognit:
min-complexity: 10
gocyclo:
min-complexity: 15
goimports:
local-prefixes: capuchin
gosec:
excludes:
- G108 # Profiling endpoint automatically exposed on /debug/pprof
govet:
# Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.
enable-all: true
disable:
- fieldalignment # Использовать при необходимости, ухудшается читаемость кода
- slog # На проекте используется zap
settings:
shadow:
strict: true
iface:
enable:
- identical
- unused
- opaque
nestif:
min-complexity: 4
nolintlint:
require-explanation: true
require-specific: true
revive:
enable-all-rules: true
settings:
cyclop:
max-complexity: 15
depguard:
rules:
main:
list-mode: lax
deny:
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
- pkg: github.com/golang/protobuf
desc: Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules
errcheck:
check-type-assertions: true
errorlint:
errorf: false
exhaustive:
default-signifies-exhaustive: true
explicit-exhaustive-switch: true
gocognit:
min-complexity: 10
gocyclo:
min-complexity: 15
gosec:
excludes:
- G108
govet:
disable:
- fieldalignment
- slog
enable-all: true
settings:
shadow:
strict: true
iface:
enable:
- identical
- unused
- opaque
nestif:
min-complexity: 4
nolintlint:
require-explanation: true
require-specific: true
revive:
enable-all-rules: true
rules:
- name: add-constant
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
disabled: true
- name: cyclomatic
disabled: true
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: unused-parameter
disabled: true
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
tagliatelle:
case:
use-field-name: true
testifylint:
enable-all: true
disable:
- require-error
unparam:
check-exported: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- name: add-constant
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
disabled: true
- name: cyclomatic
disabled: true
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: unused-parameter
disabled: true
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
tagliatelle:
case:
use-field-name: true
testifylint:
enable-all: true
disable:
- require-error
unparam:
check-exported: true

- linters:
- govet
text: '^shadow: declaration of "err" shadows declaration.+'
- linters:
- cyclop
path: (.+)_test\.go
paths:
- third_party$
- builtin$
- examples$
issues:
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 50

exclude-rules:
- linters:
- govet
text: '^shadow: declaration of "err" shadows declaration.+'
formatters:
enable:
- gci
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(geeksonator)
goimports:
local-prefixes:
- capuchin
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang 1.23.6
golangci-lint 1.64.5
golang 1.25.8
golangci-lint 2.11.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# STEP 1 build executable binary #
##################################

FROM golang:1.23.6-alpine as builder
FROM golang:1.25-alpine as builder

LABEL org.opencontainers.image.source="https://github.com/phpgeeks-club/admin-bot"

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module geeksonator

go 1.23.6
go 1.25

require (
github.com/caarlos0/env/v10 v10.0.0
Expand Down
Loading