-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Update go tool dependencies, restructure lint targets #24239
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
Merged
+88
−58
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ea2c30b
Update go tool dependencies
silverwind 32c0c88
try enable wastedassign
silverwind 83223b6
add golangci-lint-fix target
silverwind b8c3566
fix some lints
silverwind defad27
fix more lints
silverwind bf7fa9f
fix one more lint
silverwind 28b9456
fix build
silverwind 6769108
try disable gocritic
silverwind ec7abf5
fix last lint
silverwind 39477b1
fix lints, re-enable gocritic
silverwind 2f4f35f
restore deleted line
silverwind 87f3327
remove all println in gitdiff_test.go
silverwind 8b0a1fa
restructure lint targets
silverwind 8c7b1cc
re-order help
silverwind 58b0abe
add lint-fix
silverwind d5a8bcd
change lint-fix to lint everything, add intermediate targets
silverwind 117ee6b
add help
silverwind a9400f7
reword help for consistency
silverwind 87fbbe9
restart ci
silverwind 967ad6e
fix new lint error
silverwind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -25,16 +25,15 @@ COMMA := , | |
|
||
XGO_VERSION := go-1.20.x | ||
|
||
AIR_PACKAGE ?= github.com/cosmtrek/[email protected] | ||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected] | ||
ERRCHECK_PACKAGE ?= github.com/kisielk/[email protected] | ||
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected] | ||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected] | ||
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected] | ||
AIR_PACKAGE ?= github.com/cosmtrek/[email protected] | ||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected] | ||
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected] | ||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected] | ||
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected] | ||
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected] | ||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected] | ||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest | ||
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.5.0 | ||
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 | ||
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest | ||
|
||
DOCKER_IMAGE ?= gitea/gitea | ||
|
@@ -194,9 +193,20 @@ help: | |
@echo " - deps-backend install backend dependencies" | ||
@echo " - deps-tools install tool dependencies" | ||
@echo " - lint lint everything" | ||
@echo " - lint-fix lint everything and fix issues" | ||
@echo " - lint-frontend lint frontend files" | ||
@echo " - lint-frontend-fix lint frontend files and fix issues" | ||
@echo " - lint-backend lint backend files" | ||
@echo " - lint-backend-fix lint backend files and fix issues" | ||
@echo " - lint-go lint go files" | ||
@echo " - lint-go-fix lint go files and fix issues" | ||
@echo " - lint-go-vet lint go files with vet" | ||
@echo " - lint-js lint js files" | ||
@echo " - lint-js-fix lint js files and fix issues" | ||
@echo " - lint-css lint css files" | ||
@echo " - lint-css-fix lint css files and fix issues" | ||
@echo " - lint-md lint markdown files" | ||
@echo " - lint-swagger lint swagger files" | ||
@echo " - checks run various consistency checks" | ||
@echo " - checks-frontend check frontend files" | ||
@echo " - checks-backend check backend files" | ||
|
@@ -214,9 +224,7 @@ help: | |
@echo " - generate-manpage generate manpage" | ||
@echo " - generate-swagger generate the swagger spec from code comments" | ||
@echo " - swagger-validate check if the swagger spec is valid" | ||
@echo " - golangci-lint run golangci-lint linter" | ||
@echo " - go-licenses regenerate go licenses" | ||
@echo " - vet examines Go source code and reports suspicious constructs" | ||
@echo " - tidy run go mod tidy" | ||
@echo " - test[\#TestSpecificName] run unit test" | ||
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" | ||
|
@@ -286,12 +294,6 @@ fmt-check: fmt | |
misspell-check: | ||
go run $(MISSPELL_PACKAGE) -error $(GO_DIRS) $(WEB_DIRS) | ||
|
||
.PHONY: vet | ||
vet: | ||
@echo "Running go vet..." | ||
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet | ||
@$(GO) vet -vettool=gitea-vet $(GO_PACKAGES) | ||
|
||
.PHONY: $(TAGS_EVIDENCE) | ||
$(TAGS_EVIDENCE): | ||
@mkdir -p $(MAKE_EVIDENCE_DIR) | ||
|
@@ -324,11 +326,6 @@ swagger-validate: | |
$(GO) run $(SWAGGER_PACKAGE) validate './$(SWAGGER_SPEC)' | ||
$(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)' | ||
|
||
.PHONY: errcheck | ||
errcheck: | ||
@echo "Running errcheck..." | ||
$(GO) run $(ERRCHECK_PACKAGE) $(GO_PACKAGES) | ||
|
||
.PHONY: checks | ||
checks: checks-frontend checks-backend | ||
|
||
|
@@ -341,18 +338,69 @@ checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-valida | |
.PHONY: lint | ||
lint: lint-frontend lint-backend | ||
|
||
.PHONY: lint-fix | ||
lint-fix: lint-frontend-fix lint-backend-fix | ||
|
||
.PHONY: lint-frontend | ||
lint-frontend: node_modules lint-md | ||
lint-frontend: lint-js lint-css lint-md lint-swagger | ||
|
||
.PHONY: lint-frontend-fix | ||
lint-frontend-fix: lint-js-fix lint-css-fix lint-md lint-swagger | ||
|
||
.PHONY: lint-backend | ||
lint-backend: lint-go lint-go-vet lint-editorconfig | ||
|
||
.PHONY: lint-backend-fix | ||
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig | ||
|
||
.PHONY: lint-js | ||
lint-js: node_modules | ||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e | ||
|
||
.PHONY: lint-js-fix | ||
lint-js-fix: node_modules | ||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e --fix | ||
|
||
.PHONY: lint-css | ||
lint-css: node_modules | ||
npx stylelint --color --max-warnings=0 web_src/css | ||
|
||
.PHONY: lint-css-fix | ||
lint-css-fix: node_modules | ||
npx stylelint --color --max-warnings=0 web_src/css --fix | ||
|
||
.PHONY: lint-swagger | ||
lint-swagger: node_modules | ||
npx spectral lint -q -F hint $(SWAGGER_SPEC) | ||
|
||
.PHONY: lint-md | ||
lint-md: node_modules | ||
npx markdownlint docs *.md | ||
|
||
.PHONY: lint-backend | ||
lint-backend: golangci-lint vet editorconfig-checker | ||
.PHONY: lint-go | ||
lint-go: | ||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run | ||
|
||
.PHONY: lint-go-fix | ||
lint-go-fix: | ||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix | ||
|
||
# workaround step for the lint-backend-windows CI task because 'go run' can not | ||
# have distinct GOOS/GOARCH for its build and run steps | ||
.PHONY: lint-go-windows | ||
lint-go-windows: | ||
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE) | ||
golangci-lint run | ||
|
||
.PHONY: lint-go-vet | ||
lint-go-vet: | ||
@echo "Running go vet..." | ||
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet | ||
@$(GO) vet -vettool=gitea-vet $(GO_PACKAGES) | ||
|
||
.PHONY: lint-editorconfig | ||
lint-editorconfig: | ||
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates | ||
|
||
.PHONY: watch | ||
watch: | ||
|
@@ -843,7 +891,6 @@ deps-backend: | |
deps-tools: | ||
$(GO) install $(AIR_PACKAGE) | ||
$(GO) install $(EDITORCONFIG_CHECKER_PACKAGE) | ||
$(GO) install $(ERRCHECK_PACKAGE) | ||
$(GO) install $(GOFUMPT_PACKAGE) | ||
$(GO) install $(GOLANGCI_LINT_PACKAGE) | ||
$(GO) install $(GXZ_PAGAGE) | ||
|
@@ -942,21 +989,6 @@ generate-manpage: | |
@gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created | ||
@#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page | ||
|
||
.PHONY: golangci-lint | ||
golangci-lint: | ||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run | ||
|
||
# workaround step for the lint-backend-windows CI task because 'go run' can not | ||
# have distinct GOOS/GOARCH for its build and run steps | ||
.PHONY: golangci-lint-windows | ||
golangci-lint-windows: | ||
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE) | ||
golangci-lint run | ||
|
||
.PHONY: editorconfig-checker | ||
editorconfig-checker: | ||
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates | ||
|
||
.PHONY: docker | ||
docker: | ||
docker build --disable-content-trust=false -t $(DOCKER_REF) . | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.