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
7 changes: 3 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- v*
branches:
- master
- main
pull_request:

permissions:
Expand All @@ -16,12 +15,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version: '1.20.x'
go-version: '1.25.x'

- name: Build
run: go build -v ./...
34 changes: 7 additions & 27 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,22 @@ on:
- v*
branches:
- master
- main
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v6
with:
go-version: '1.20.x'
- uses: actions/checkout@v4
go-version: '1.25.x'
- uses: actions/checkout@v6
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v9
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
version: v2.8.0
9 changes: 5 additions & 4 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version: '1.20.x'
go-version: '1.25.x'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
217 changes: 147 additions & 70 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,159 @@
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 30m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# skip files
skip-files:
- ".*\\_gen\\.go$"

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

linters-settings:
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/vmkteam/zenrpc
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-checks:
- appendAssign
- appendCombine
- assignOp
- badCond
- boolExprSimplify
- captLocal
- caseOrder
- defaultCaseOrder
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- emptyFallthrough
- emptyStringTest
- equalFold
- exitAfterDefer
- flagName
- hexLiteral
- indexAlloc
- nilValReturn
- offBy1
- regexpMust
- sloppyLen
- switchTrue
- wrapperFunc
- yodaStyleExpr
version: "2"

linters:
enable-all: false
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- dogsled
- canonicalheader
- copyloopvar
- cyclop
- dupl
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exptostd
- fatcontext
#- forbidigo
- funcorder
- funlen
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gofmt
- goimports
- gosimple
- gocritic
- gocyclo
- goprintffuncname
- govet
- iface
- ineffassign
- intrange
- loggercheck
- makezero
- mirror
- nestif
- nilerr
- nilnesserr
- noctx
- nosprintfhostport
- perfsprint
- predeclared
- promlinter
- protogetter
- recvcheck
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- typecheck
- testableexamples
- testifylint
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- wastedassign
- whitespace
- decorder
- ginkgolinter
- goheader
- inamedparam
- interfacebloat
- prealloc
- zerologlint
settings:
cyclop:
max-complexity: 30
package-average: 10.0

errcheck:
check-type-assertions: true

exhaustive:
check:
- switch
- map

funcorder:
struct-method: false

funlen:
lines: 100
statements: 50

gochecksumtype:
default-signifies-exhaustive: false

gocognit:
min-complexity: 32

gocritic:
settings:
captLocal:
paramsOnly: false
underef:
skipRecvDeref: false

govet:
enable-all: true
disable:
- fieldalignment
settings:
shadow:
strict: false

inamedparam:
skip-single-param: true

nakedret:
max-func-lines: 0

perfsprint:
strconcat: false

staticcheck:
checks:
- all
- -ST1000
- -ST1016
- -QF1008

usetesting:
os-temp-dir: true

exclusions:
warn-unused: false
presets:
- std-error-handling
- common-false-positives
rules:
- source: 'TODO'
linters: [ godot ]
- path: '_test\.go'
linters:
- bodyclose
- dupl
- errcheck
- funlen
- goconst
- noctx

formatters:
enable:
- gci
settings:
gci:
sections:
- standard
- localmodule
- default
no-inline-comments: true
no-prefix-comments: true
custom-order: true
no-lex-order: true
16 changes: 16 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
version: 2

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64

homebrew_casks:
- name: pgmigrator
binaries:
- pgmigrator
homepage: "https://github.com/vmkteam/pgmigrator"
description: "Command-line tool for PostgreSQL migrations"
repository:
owner: vmkteam
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
PKG := `go list -f {{.Dir}} ./...`

LINT_VERSION := v2.8.0

fmt:
@goimports -local "github.com/vmkteam/pgmigrator" -l -w $(PKG)
@golangci-lint fmt

lint:
@golangci-lint run -c .golangci.yml
@golangci-lint version
@golangci-lint config verify
@golangci-lint run

test:
@go test -v ./...
Expand Down
Loading
Loading