diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-11-17 20:34:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 20:34:35 +0800 |
commit | 750a8465f547e9f08a87612c75898d56b8ec1f88 (patch) | |
tree | f3eed8b40971c01a75617675a24014233b9f1cc7 /Makefile | |
parent | 29cc169d20fc995072a819da6f996717a9899b3b (diff) | |
download | gitea-750a8465f547e9f08a87612c75898d56b8ec1f88.tar.gz gitea-750a8465f547e9f08a87612c75898d56b8ec1f88.zip |
A better go code formatter, and now `make fmt` can run in Windows (#17684)
* go build / format tools
* re-format imports
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -58,8 +58,6 @@ else SED_INPLACE := sed -i '' endif -GOFMT ?= gofmt -s - EXTRA_GOFLAGS ?= MAKE_VERSION := $(shell $(MAKE) -v | head -n 1) @@ -127,8 +125,6 @@ ifeq ($(filter $(TAGS_SPLIT),bindata),bindata) GO_SOURCES += $(BINDATA_DEST) endif -GO_SOURCES_OWN := $(filter-out vendor/% %/bindata.go, $(GO_SOURCES)) - #To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger SWAGGER := $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger SWAGGER_SPEC := templates/swagger/v1_json.tmpl @@ -238,7 +234,7 @@ clean: .PHONY: fmt fmt: @echo "Running go fmt..." - @$(GOFMT) -w $(GO_SOURCES_OWN) + @$(GO) run build/code-batch-process.go gitea-fmt -s -w '{file-list}' .PHONY: vet vet: @@ -298,7 +294,7 @@ misspell-check: $(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \ fi @echo "Running misspell-check..." - @misspell -error -i unknwon $(GO_SOURCES_OWN) + @$(GO) run build/code-batch-process.go misspell -error -i unknwon '{file-list}' .PHONY: misspell misspell: @@ -306,12 +302,12 @@ misspell: $(GO) install github.com/client9/misspell/cmd/misspell@v0.3.4; \ fi @echo "Running go misspell..." - @misspell -w -i unknwon $(GO_SOURCES_OWN) + @$(GO) run build/code-batch-process.go misspell -w -i unknwon '{file-list}' .PHONY: fmt-check fmt-check: # get all go files and run go fmt on them - @diff=$$($(GOFMT) -d $(GO_SOURCES_OWN)); \ + @diff=$$($(GO) run build/code-batch-process.go gitea-fmt -s -d '{file-list}'); \ if [ -n "$$diff" ]; then \ echo "Please run 'make fmt' and commit the result:"; \ echo "$${diff}"; \ |