-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring and removing check.v1 #20
Changes from all commits
915b478
c0d4342
414d44e
ca306c4
0e9e048
43baec7
0cecebc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
linters: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- decorder | ||
- dogsled | ||
- dupl | ||
- dupword | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- execinquery | ||
- exhaustive | ||
- exportloopref | ||
- forcetypeassert | ||
- ginkgolinter | ||
- gocheckcompilerdirectives | ||
- gochecknoinits | ||
- gochecksumtype | ||
- goconst | ||
- gofmt | ||
- goheader | ||
- goimports | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- gosmopolitan | ||
- govet | ||
- grouper | ||
- importas | ||
- ineffassign | ||
- loggercheck | ||
- makezero | ||
- mirror | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- reassign | ||
- revive | ||
- rowserrcheck | ||
- sloglint | ||
- spancheck | ||
- sqlclosecheck | ||
- stylecheck | ||
- tagalign | ||
- tagliatelle | ||
- tenv | ||
- testableexamples | ||
- testifylint | ||
- thelper | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- wastedassign | ||
- whitespace | ||
- zerologlint |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
# Go parameters | ||
GOCMD = go | ||
GOTEST = $(GOCMD) test | ||
|
||
GOLANGCI_VERSION ?= v1.57.2 | ||
TOOLS_BIN := $(shell mkdir -p build/tools && realpath build/tools) | ||
|
||
GOLANGCI = $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION) | ||
$(GOLANGCI): | ||
rm -f $(TOOLS_BIN)/golangci-lint* | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_VERSION) | ||
mv $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION) | ||
|
||
test: | ||
$(GOTEST) ./... | ||
|
||
generate: $(esc) | ||
$(GOCMD) generate | ||
validate: validate-lint validate-dirty ## Run validation checks. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? Instead, we can use a build workflow to run the linter. Contributors should have their editor linter set up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea here is mostly to align CI and local, with the least amount of assumptions about a developer/contributors' environment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merging it as is, but happy to discuss further what this should look like across the org. |
||
|
||
validate-lint: $(GOLANGCI) | ||
$(GOLANGCI) run | ||
|
||
define go-install-tool | ||
@[ -f $(1) ] || { \ | ||
set -e ;\ | ||
echo "Downloading $(2)" ;\ | ||
GOBIN=$(TOOLS_BIN) go install $(2) ;\ | ||
} | ||
endef | ||
|
||
validate-dirty: | ||
ifneq ($(shell git status --porcelain --untracked-files=no),) | ||
@echo worktree is dirty | ||
@git --no-pager status | ||
@git --no-pager diff | ||
@exit 1 | ||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,3 @@ ls .git/objects/pack/ | |
PackfileHash: "<PACK_HASH>", | ||
} | ||
``` | ||
|
||
4. Run `make generate`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.