Hi all,

we have discussed this topic 1 or 2 month ago..

First of all, thank Yongwei Liu and Yanhong Wang's big contribution to
IoTDB-client-go.
And it is time to let the main repo (iotdb repo) maintains the sub-repo.

I submit a PR[1] for this.

ONCE THE PR IS MERGED, WE HAVE TO FOLLOW THE STEPS:

## How to get source codes of the submodule

when you git clone or git pull the repo, the git command does not
clone/pull codes in the submodules automatically;
(1) for the first time, you need to run: cd client-go && git submodule
update --init
(2) for the 2nd time or the future usage, just run git submodule update to
get latest codes of the submodule.

Notice: when you pull the codes, the submodule is on an anonymous branch.
you need to use git checkout <existing branch> or git checkout -b <new
branch> in the client-go folder.

## How to modify codes of the submodule

cd client-go, and do whatever you want to do, and then commit codes here by
git add, git commit and git push command;
cd iotdb's root folder, when you run git status at this time, you will find
it shows client-go is modified, so just run git add client-go to let the
parent repo knows the submodule's repo is updated.
Notice, git checkout to a new/existing branch on client-go folder will be
considered as a modification operation. And, if you want IoTDB repo knows
you want to link a new branch of client-go to iotdb's repo, you can run git
checkout command in client-go folder.

## Example

Scenario:
I want to modify the Thrift definition in IoTDB, and need to maintain the
go client.

Step 1: modify the thrift file and modify codes in IoTDB.
Step 2: cd client-go, checkout to a new branch, modify codes..
(Especially, the client-go has to copy generated thrift codes to
client-go/rpc/, there are two choices to do that:
a. run mvn generate-sources in iotdb's folder (not supported now in this
PR. will do it later)
b. cd client-go, run make generate
)
Step 3: in client-go, git add, git commit and git push
Step 4: int IoTDB's root folder, git add, git commit and git push
Step 5: submit a PR to IoTDB, and wait for the success of CI in IoTDB's
repo;
Step 6: If success, then submit a PR to iotdb-client-go repo, and paste the
PR address in IoTDB. (The github action in iotdb-client-go will fail
because it just clone codes of iotdb's master branch. However, our
modifications of IoTDB are in another branch. So, we need the github action
result in IoTDB to show the correction of the modifications in
IoTDB-client-go).
Step 7: After all reviewers approve the PRs in both IoTDB and
IoTDB-client-go,
Step 7.1. Merge PR in iotdb-client-go first, and
Step 7.2. cd client-go folder, checkout back to the main branch (the
iotdb-client-go repo uses main ratherthan master). Then git add, git commit
and git push
Step 7.3 After that, send notification on your PR and let others merge the
PR in IoTDB

[1] https://github.com/apache/iotdb/pull/2792

Best,
-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院

Reply via email to