Skip to content

Commit

Permalink
Update go-makefile-maker config
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Aug 31, 2023
1 parent e70a867 commit cf3712c
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 3 deletions.
135 changes: 135 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

run:
deadline: 3m # 1m by default
modules-download-mode: vendor

output:
# Do not print lines of code with issue.
print-issued-lines: false

issues:
exclude:
# It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
# Ref: https://go.dev/doc/effective_go#redeclaration
- 'declaration of "err" shadows declaration at'
exclude-rules:
- path: _test\.go
linters:
- bodyclose
# '0' disables the following options.
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
dupl:
# Tokens count to trigger issue, 150 by default.
threshold: 100
errcheck:
# Report about assignment of errors to blank identifier.
check-blank: true
# Report about not checking of errors in type assertions.
check-type-assertions: true
forbidigo:
forbid:
# ioutil package has been deprecated: https://github.com/golang/go/issues/42026
- ^ioutil\..*$
# Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
- ^http.DefaultServeMux$
- ^http.Handle(?:Func)?$
gocritic:
enabled-checks:
- boolExprSimplify
- builtinShadow
- emptyStringTest
- evalOrder
- httpNoBody
- importShadow
- initClause
- methodExprCall
- paramTypeCombine
- preferFilepathJoin
- ptrToRefParam
- redundantSprint
- returnAfterHttpError
- stringConcatSimplify
- timeExprSimplify
- truncateCmp
- typeAssertChain
- typeUnparen
- unnamedResult
- unnecessaryBlock
- unnecessaryDefer
- weakCond
- yodaStyleExpr
goimports:
# Put local imports after 3rd-party packages.
local-prefixes: github.com/sapcc/backup-tools
gosec:
excludes:
# gosec wants us to set a short ReadHeaderTimeout to avoid Slowloris attacks, but doing so would expose us to Keep-Alive race conditions (see https://iximiuz.com/en/posts/reverse-proxy-http-keep-alive-and-502s/)
- G112
# created file permissions are restricted by umask if necessary
- G306
govet:
# Report about shadowed variables.
check-shadowing: true
nolintlint:
require-specific: true
usestdlibvars:
constant-kind: true
crypto-hash: true
default-rpc-path: true
http-method: true
http-status-code: true
os-dev-null: true
rpc-default-path: true
time-weekday: true
time-month: true
time-layout: true
tls-signature-scheme: true
whitespace:
# Enforce newlines (or comments) after multi-line function signatures.
multi-func: true

linters:
# We use 'disable-all' and enable linters explicitly so that a newer version
# does not introduce new linters unexpectedly.
disable-all: true
enable:
- bodyclose
- containedctx
- dupl
- dupword
- durationcheck
- errcheck
- errorlint
- exportloopref
- forbidigo
- gocheckcompilerdirectives
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- noctx
- nolintlint
- nosprintfhostport
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tenv
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- whitespace
10 changes: 7 additions & 3 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ dockerfile:
- curl # required for backup-tools.sh
- jq # required for backup-tools.sh

golang:
enableVendoring: true
setGoModVersion: true

golangciLint:
createConfig: true

githubWorkflow:
ci:
enabled: true
Expand All @@ -38,9 +45,6 @@ renovate:
- majewsky
- SuperSandro2000

vendoring:
enabled: true

# The "install" target is autogenerated to install the Go binary, but we also
# need to install the backup-tools.sh script into $PATH.
verbatim: |
Expand Down

0 comments on commit cf3712c

Please sign in to comment.