-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use golangci-lint & fix formatting
- Loading branch information
Showing
45 changed files
with
345 additions
and
244 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 |
---|---|---|
|
@@ -9,5 +9,5 @@ jobs: | |
go-version: "1.20" | ||
- name: test | ||
run: | | ||
make install-goimports | ||
make lint | ||
make test |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
/tools |
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,108 @@ | ||
# Using [email protected] | ||
run: | ||
timeout: 5m | ||
tests: true | ||
skip-dirs: | ||
- vendor$ | ||
output: | ||
print-linter-name: true | ||
linters: | ||
enable-all: true | ||
fast: false | ||
disable: | ||
# Deprecated (see https://golangci-lint.run/usage/linters/) | ||
- deadcode | ||
- golint | ||
- ifshort | ||
- interfacer | ||
- maligned | ||
- nosnakecase | ||
- scopelint | ||
- structcheck | ||
- varcheck | ||
- exhaustivestruct | ||
|
||
# Annoying style guides that are very subjective | ||
- funlen | ||
- nlreturn | ||
- wsl | ||
- cyclop | ||
- varnamelen | ||
- maintidx | ||
- gocognit | ||
- godot | ||
- gocyclo | ||
- nestif | ||
- nilnil | ||
- exhaustruct | ||
|
||
# Requires too many changes | ||
- testpackage | ||
|
||
- thelper | ||
- wrapcheck | ||
- testifylint | ||
|
||
# TODO | ||
- usestdlibvars | ||
- paralleltest | ||
- perfsprint | ||
- staticcheck | ||
- gomnd | ||
- nonamedreturns | ||
- goerr113 | ||
- gochecknoglobals | ||
- dupword | ||
- depguard | ||
- unparam | ||
- revive | ||
- stylecheck | ||
- unused | ||
- protogetter | ||
- lll | ||
- prealloc | ||
- forcetypeassert | ||
- gocritic | ||
- forbidigo | ||
- dupl | ||
- errcheck | ||
- gosec | ||
- ineffassign | ||
- wastedassign | ||
|
||
linters-settings: | ||
tagliatelle: | ||
case: | ||
rules: | ||
json: snake | ||
yaml: kebab | ||
depguard: | ||
rules: | ||
main: | ||
deny: | ||
- pkg: "github.com/pkg/errors" | ||
desc: "Please use go built-in error wrapping and handling via `fmt` and `errors` packages" | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/form3tech-oss/f1) | ||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude-rules: | ||
# exclude long lines with URLs | ||
- path: \.go | ||
source: https:// | ||
linters: | ||
- lll | ||
# Don't wrap check RoundTrip | ||
- path: \.go | ||
source: RoundTrip | ||
linters: | ||
- wrapcheck | ||
- path: _test\.go | ||
linters: | ||
# unwrapped errors are ok in tests | ||
- wrapcheck | ||
|
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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
GO_FILES?=$$(find ./ -name '*.go' | grep -v /vendor | grep -v /template/ | grep -v /build/ | grep -v swagger-client) | ||
GOLANGCI_VERSION := 1.56.2 | ||
|
||
test: goimportscheck | ||
.PHONY: test | ||
test: | ||
go test ./... -v -race -failfast -p 1 -mod=readonly | ||
|
||
require-travis-env: | ||
ifndef TRAVIS | ||
$(error TRAVIS is undefined) | ||
endif | ||
.PHONY: tools/golangci-lint | ||
tools/golangci-lint: | ||
@echo "==> Installing golangci-lint..." | ||
@./scripts/install-golangci-lint.sh $(GOLANGCI_VERSION) | ||
|
||
install-goimports: | ||
@if [ -z "$$(command -v goimports)" ]; then \ | ||
go get golang.org/x/tools/cmd/goimports; \ | ||
fi | ||
.PHONY: lint | ||
lint: tools/golangci-lint | ||
@echo "==> Running golangci-lint..." | ||
@tools/golangci-lint run --timeout 600s | ||
|
||
.PHONY: lint-fix | ||
lint-fix: tools/golangci-lint | ||
@echo "==> Running golangci-lint..." | ||
@tools/golangci-lint run --timeout 600s --fix | ||
|
||
goimports: | ||
@goimports -w $(GO_FILES) | ||
|
||
goimportscheck: | ||
@sh -c "'$(CURDIR)/scripts/goimportscheck.sh'" |
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
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
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.