-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
767 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e -o pipefail | ||
|
||
# https://github.com/koalaman/shellcheck/wiki/SC2039#redirect-both-stdout-and-stderr | ||
if ! command -v golangci-lint 2>&1 /dev/null; then | ||
echo "golangci-lint is not installed" | ||
exit 1 | ||
fi | ||
|
||
exec golangci-lint --build-tags=race run "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,6 @@ jobs: | |
- name: Run linter | ||
uses: golangci/[email protected] # Action page: <https://github.com/golangci/golangci-lint-action> | ||
with: | ||
version: v1.56 # without patch version | ||
version: v1.58 # without patch version | ||
only-new-issues: false # show only new issues if it's a pull request | ||
args: --timeout=10m --build-tags=race ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Documentation: <https://github.com/golangci/golangci-lint#config-file> | ||
|
||
run: | ||
timeout: 1m | ||
allow-parallel-runners: true | ||
|
||
output: | ||
formats: | ||
- format: colored-line-number | ||
|
||
linters-settings: | ||
wsl: | ||
allow-assign-and-anything: true | ||
godot: | ||
scope: declarations | ||
capital: true | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
misspell: | ||
locale: US | ||
lll: | ||
line-length: 120 | ||
prealloc: | ||
simple: true | ||
range-loops: true | ||
for-loops: true | ||
nolintlint: | ||
require-specific: true | ||
|
||
linters: # All available linters list: <https://golangci-lint.run/usage/linters/> | ||
disable-all: true | ||
enable: | ||
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers | ||
- bodyclose # Checks whether HTTP response body is closed successfully | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) | ||
- dupl # Tool for code clone detection | ||
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases | ||
- errorlint # find code that will cause problems with the error wrapping scheme introduced in Go 1.13 | ||
- exhaustive # check exhaustiveness of enum switch statements | ||
- exportloopref # checks for pointers to enclosing loop variables | ||
- gochecknoglobals # Checks that no globals are present in Go code | ||
- goconst # Finds repeated strings that could be replaced by a constant | ||
- gocritic # The most opinionated Go source code linter | ||
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification | ||
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports | ||
- revive | ||
- goprintffuncname # Checks that printf-like functions are named with `f` at the end | ||
- gosec # Inspects source code for security problems | ||
- gosimple # Linter for Go source code that specializes in simplifying a code | ||
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string | ||
- ineffassign # Detects when assignments to existing variables are not used | ||
- misspell # Finds commonly misspelled English words in comments | ||
- nakedret # Finds naked returns in functions greater than a specified function length | ||
- noctx # finds sending http request without context.Context | ||
- nolintlint # Reports ill-formed or insufficient nolint directives | ||
- prealloc # Finds slice declarations that could potentially be preallocated | ||
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks | ||
- stylecheck # Stylecheck is a replacement for golint | ||
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes | ||
- unconvert # Remove unnecessary type conversions | ||
- unparam # Reports unused function parameters | ||
- unused # Checks Go code for unused constants, variables, functions and types | ||
- whitespace # Tool for detection of leading and trailing whitespace | ||
|
||
issues: | ||
exclude-files: | ||
# staticcheck internal file | ||
- internal/debug/server_test.go | ||
exclude-dirs: | ||
- .github | ||
- .git | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- dupl | ||
- funlen | ||
- scopelint | ||
- gocognit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
cp ./.githooks/pre-commit .git/hooks/pre-commit | ||
|
||
echo "DONE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.