diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77adfb65..ee7e0b5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,22 @@ It is the work of hundreds of contributors. We appreciate your help! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete. +## Prepare environment + +Firstly, install some tools. Execute those commands **outside** the project. Or those command will modify go.mod file. + +```shell script +go get -u golang.org/x/tools/cmd/goimports + +go get -u github.com/gordonklaus/ineffassign +``` + +And the go into project directory, run : +```shell script +cp ./githook/pre-commit ./.git/hooks/pre-commit +``` +This will add git hooks into .git/hooks. Or you can add it manually. + ## Contribution guidelines ### Pull requests diff --git a/scripts/gobuild.sh b/build/gobuild-sample.sh similarity index 100% rename from scripts/gobuild.sh rename to build/gobuild-sample.sh diff --git a/scripts/report_build_info.sh b/build/report_build_info.sh similarity index 100% rename from scripts/report_build_info.sh rename to build/report_build_info.sh diff --git a/githook/pre-commit b/githook/pre-commit new file mode 100755 index 00000000..594f1edd --- /dev/null +++ b/githook/pre-commit @@ -0,0 +1,7 @@ + +goimports -l pkg +goimports -l examples + +ineffassign . + +staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024" ./pkg \ No newline at end of file