Project: BFE (Orchestration & Management / Service Proxy)
File: local_dev_guide.md

You will learn how to develop BFE in local environment under the guidelines of this document. Please refer to the coding format of golang Unit test is needed for all codes. Pass through all unit tests. Please follow The following guidiance tells you how to submit code. Transfer to the home page of Github ,and then click button `Fork` to generate the git under your own file directory,such as <https://github.com/USERNAME/bfe> Clone remote git to local: ```bash $ git clone https://github.com/USERNAME/bfe $ cd bfe ``` At present is applied to BFE to undergo task of development,test,release and maintenance.Please refer to about details All development tasks of feature and bug fix should be finished in a new branch which is extended from `develop` branch. Create and switch to a new branch with command `git checkout -b`. ```bash $ git checkout -b my-cool-stuff ``` It is worth noting that before the checkout, you need to keep the current branch directory clean, otherwise the untracked file will be brought to the new branch, which can be viewed by `git status` . `make deps` install all the dependent tools, include `pre-commit` `goyacc` `license-eye` `staticcheck`. BFE developers use the tool to manage Git pre-commit hooks. It helps us format the source code and automatically check some basic things before committing (such as having only one EOL per file, not adding large files in Git, etc.). The `pre-commit` test is part of the unit test in Travis-CI. A PR that does not satisfy the hook cannot be submitted to BFE. Install `pre-commit` first and then run it in current directory ```bash $ make deps $ make precommit ``` BFE modify the format of golang source code with `gofmt` . helps us check and fix file's license header declaration. All files' license header should be done before committing. The `license-eye` check is part of the Github-Action. A PR that check failed cannot be submitted to BFE. Install `license-eye` and do check or fix: ```bash $ make deps $ make license-check $ make license-fix ``` I delete a line of README.md and create a new file in the

View the current state via `git status` , which will prompt some changes to the current directory, and you can also view the file's specific changes via `git diff` . ```bash $ git status On branch test Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md Untracked files: (use "git add <file>..." to include in what will be committed) test no changes added to commit (use "git add" and/or "git commit -a") ``` Please refer to about construction and test. Next we cancel the modification of README.md,and submit new added test file. ```bash $ git checkout -- README.md $ git status On branch test Untracked files: (use "git add <file>..." to include in what will be committed) test nothing added to commit but untracked files present (use "git add" to track) $ git add test ``` It's required that the commit message is also given on every Git commit, through which other developers will be notified of what changes have been made. Type `git commit` to realize it. ```bash $ git commit CRLF end-lines remover...............................(no files to check)Skipped yapf.................................................(no files to check)Skipped Check for added large files..............................................Passed Check for merge conflicts................................................Passed Check for broken symlinks................................................Passed Detect Private Key...................................(no files to check)Skipped Fix End of Files.....................................(no files to check)Skipped clang-formatter.......................................(no files to check)Skipped [my-cool-stuff c703c041] add test file 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 233 ``` <b> <font color="red">Attention needs to be paidyou need to add commit message to trigger CI test.The command is as follows:</font> </b> ```bash $ git commit -m "test=develop" $ git commit -m "test=release/1.1" ``` It needs to keep up with the latest code of original repository(<https://github.com/bfenetworks/bfe>before Pull Request. Check the name of current remote repository with `git remote`. ```bash $ git remote origin $ git remote -v origin https://github.com/USERNAME/bfe (fetch) origin https://github.com/USERNAME/bfe (push) ``` origin is the name of remote repository that we clone, which is also the BFE under your own account. Next we create a remote host of an original BFE and name it upstream. ```bash $ git remote add upstream https://github.com/bfenetworks/bfe $ git remote origin upstream ``` Get the latest code of upstream and update current branch. ```bash $ git fetch upstream $ git pull upstream develop ``` Push local modification to GitHub(https://github.com/USERNAME/bfe). ```bash $ git push origin my-cool-stuff ```