Skip to content
Open
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
164 changes: 164 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
version: "2"
linters:
# Default set of linters.
# The value can be:
# - `standard`: https://golangci-lint.run/docs/linters/#enabled-by-default
# - `all`: enables all linters by default.
# - `none`: disables all linters by default.
# - `fast`: enables only linters considered as "fast" (`golangci-lint help linters --json | jq '[ .[] | select(.fast==true) ] | map(.name)'`).
# Default: standard
default: none
enable:
- asciicheck
- bidichk
- bodyclose
- containedctx
# - contextcheck
- copyloopvar
# - cyclop
- decorder
- depguard
- dogsled
- dupl
- durationcheck
- embeddedstructfieldcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- funcorder
- ginkgolinter
- gochecksumtype
- goconst
- gocritic
- godoclint
- godot
- godox
- gosec
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- iotamixing
- loggercheck
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnesserr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- reassign
- recvcheck
- rowserrcheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- exhaustruct
settings:
exhaustruct:
# List of regular expressions to match type names that should be excluded from processing.
# Anonymous structs can be matched by '<anonymous>' alias.
# Has precedence over `include`.
# Each regular expression must match the full type name, including package path.
# For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`,
# but not `http\.Cookie`.
# Default: []
exclude: []
allow-empty: true
tagliatelle:
case:
rules:
json: snake
yaml: snake
nonamedreturns:
report-error-in-defer: true
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: true
exhaustive:
default-signifies-exhaustive: true
depguard:
# Rules to apply.
#
# Variables:
# - File Variables
# Use an exclamation mark `!` to negate a variable.
# Example: `!$test` matches any file that is not a go test file.
#
# `$all` - matches all go files
# `$test` - matches all go test files
#
# - Package Variables
#
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
#
# Default (applies if no custom rules are defined): Only allow $gostd in all files.
rules:
main:
list-mode: strict
# List of file globs that will match this list of settings to compare against.
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
# The placeholder '${config-path}' is substituted with a path relative to the configuration file.
# Default: $all
files:
- "$all"
- "!$test"
# List of allowed packages.
# Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).
# Default: []
allow:
- "$gostd"
- "github.com/sqlc-dev/plugin-sdk-go"
- "github.com/jinzhu/inflection"
- "github.com/rayakame/sqlc-gen-better-python"
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
formatters:
# Enable specific formatter.
# Default: [] (uses standard Go formatting)
enable:
- gci
- swaggo
- gofmt
- gofumpt
- goimports
- golines

settings:
golines:
max-len: 130
chain-split-dots: false

25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-include .env
export

.PHONY: pipelines tests fmt lint lint-fix changelog
.DEFAULT_GOAL := pipelines

pipelines:
make lint-fix
make fmt
make lint

tests:
go test -shuffle=on ./...

fmt:
golangci-lint fmt

lint:
golangci-lint run

lint-fix:
golangci-lint run --no-config --default=none --fix -E godot,intrange,misspell,nlreturn,perfsprint,tagalign

changelog:
go tool changie new
Loading
Loading