-
Notifications
You must be signed in to change notification settings - Fork 52
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
chore(Makefile): Give the help information of Makefile to make it mor… #65
Conversation
chore(Makefile): Give the help information of Makefile to make it more readable Signed-off-by: Xinwei Xiong <3293172751nss@gmail.com>
Signed-off-by: Xinwei Xiong <3293172751nss@gmail.com>
# Set the default target to build all | ||
.DEFAULT_GOAL := all | ||
|
||
# Declare all targets as phony targets |
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.
Is default help better?
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.
Yes, I think the default help information is better
Makefile
Outdated
@awk -F ':|##' '/^[^\.%\t][^\t]*:.*##/{printf " \033[36m%-20s\033[0m %s\n", $$1, $$NF}' $(MAKEFILE_LIST) | sort | ||
@echo "Usage: \n" | ||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | ||
.PHONY: help |
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.
why .PHONY is behind command
Makefile
Outdated
ut: | ||
sh .unit-test.sh | ||
|
||
## format: Run go fmt against code. |
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.
format -> fmt ?
Makefile
Outdated
.PHONY: swagger | ||
## format: Gofmt (reformat) package sources (exclude vendor dir if existed). | ||
.PHONY: format | ||
format: tools.verify.golines tools.verify.goimports |
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.
no target tools.verify.golines
Makefile
Outdated
.PHONY: swagger | ||
## format: Gofmt (reformat) package sources (exclude vendor dir if existed). | ||
.PHONY: format | ||
format: tools.verify.golines tools.verify.goimports |
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.
goimport include gofmt,so we use just goimport is ok.
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
imports:
@goimports -l -w $(SRC)
Also you can detect files which in git cache stage like below.
for file in $(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v -e "third_party" -e "Godeps"); do
# Check for files that fail gofmt.
diff="$(git show ":${file}" | gofmt -s -d)"
if [[ -n "$diff" ]]; then
files_need_gofmt="${files_need_gofmt} ${file}"
fi
done
Please retain the branch and I will resolve these issues before the branch life cycle ends |
Makefile
Outdated
|
||
.PHONY: swagger | ||
## format: Gofmt (reformat) package sources (exclude vendor dir if existed). | ||
.PHONY: format |
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.
it is good to put .PHONY
statement together
Makefile
Outdated
swagger: | ||
ifeq ($(shell uname -m),arm64) | ||
docker build -t horizon-swagger -f build/swagger/Dockerfile . --platform linux/arm64 | ||
else | ||
docker build -t horizon-swagger -f build/swagger/Dockerfile . | ||
endif | ||
|
||
.PHONY: swagger-run | ||
## swagger-run: Run the swagger |
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.
Run a swagger server locally
…e readable Signed-off-by: Xinwei Xiong <3293172751nss@gmail.com>
Signed-off-by: Xinwei Xiong <3293172751nss@gmail.com>
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.
LGTM
@echo "Comments:" | ||
@echo "" | ||
@awk -F ':|##' '/^[^\.%\t][^\t]*:.*##/{printf " \033[36m%-20s\033[0m %s\n", $$1, $$NF}' $(MAKEFILE_LIST) | sort | ||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' |
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.
empty line
# Debugging info | ||
*.debug | ||
*.exe | ||
*.test |
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.
empty line
LGTM |
I need to refer to this issue #100 |
Signed-off-by: Xinwei Xiong 3293172751nss@gmail.com
Give the help information of Makefile to make it more readable, give some necessary lab