Compare commits
No commits in common. "main" and "feat/first_try" have entirely different histories.
main
...
feat/first
60
readme.md
60
readme.md
|
@ -58,37 +58,47 @@ pub mod first;
|
||||||
```
|
```
|
||||||
這樣 first 裡面的 pub 函數就會被公開了
|
這樣 first 裡面的 pub 函數就會被公開了
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p config
|
||||||
|
cd ./config
|
||||||
|
go mod init gitea.30cm.net/Ark/library-go/config
|
||||||
|
go work use ./config
|
||||||
|
```
|
||||||
|
|
||||||
p.s 建議測試覆蓋率盡量達到80%
|
p.s 建議測試覆蓋率盡量達到80%
|
||||||
|
|
||||||
|
```bash
|
||||||
|
before-commit-check
|
||||||
|
```
|
||||||
|
|
||||||
|
2. commit
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add ./config
|
||||||
|
git commit -m "feat: add config module"
|
||||||
|
git tag "config/v1.0.0"
|
||||||
|
git push origin config/v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Merge request and Code
|
||||||
|
Review
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
## 如何使用私有Module
|
## 如何使用私有Module
|
||||||
|
|
||||||
1. 在新項目底下加入 .cargo 目錄 並新增 config.toml 檔案
|
強制git使用ssh方式而不是https:
|
||||||
```
|
|
||||||
my_project/
|
|
||||||
├── Cargo.toml
|
|
||||||
├── src/
|
|
||||||
│ ├── main.rs
|
|
||||||
│ └── utils/
|
|
||||||
│ └── first_utils/
|
|
||||||
│ └── first.rs
|
|
||||||
└── .cargo/
|
|
||||||
└── config.toml
|
|
||||||
```
|
|
||||||
|
|
||||||
2. 使用下列指令執行
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p .cargo
|
git config --global --add url."git@git.30cm.net:".insteadOf "https://gitea.30cm.net/"
|
||||||
echo "[net]\ngit-fetch-with-cli = true" > .cargo/config.toml
|
|
||||||
```
|
```
|
||||||
3. 在 cargo.toml 內加入下列指令,可指定分隻或者 tag 都可
|
|
||||||
|
|
||||||
```toml
|
設定go env
|
||||||
[dependencies]
|
|
||||||
utils = { git = "ssh://git@git.30cm.net/Wanderland/library-rusttgeoip.git", branch = "main" }
|
```bash
|
||||||
|
export GOPRIVATE="gitea.30cm.net"
|
||||||
```
|
```
|
||||||
### 如果未產生 ssh key 連線至你的 git 的話請使用下列方式
|
|
||||||
|
|
||||||
產生ssh-key
|
產生ssh-key
|
||||||
請參考 [github ssh](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) , [gitlab ssh](https://docs.gitlab.com/ee/user/ssh.html)
|
請參考 [github ssh](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) , [gitlab ssh](https://docs.gitlab.com/ee/user/ssh.html)
|
||||||
|
@ -106,8 +116,8 @@ $ touch ~/.ssh/config
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
Host code.30cm.net
|
Host yt.com
|
||||||
Hostname code.30cm.net
|
Hostname gitea.30cm.net
|
||||||
User igs170911
|
User igs170911
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
```
|
```
|
||||||
|
@ -115,3 +125,9 @@ Host code.30cm.net
|
||||||
```bash
|
```bash
|
||||||
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519
|
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519
|
||||||
```
|
```
|
||||||
|
|
||||||
|
在自己repo底下執行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go get gitea.30cm.net/Ark/library-go/config@v1.0.0
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue