機械裝甲獸(mechanorimon) ,這是一種『 載具數碼獸 』,且沒有人為操縱就無法行動。
『所有的共用工具都會放在這邊』
Go to file
王性驊 f9c90a90f5 feature/worker_pools (#5)
Co-authored-by: daniel.w <daniel.w@intteam.net>
Reviewed-on: #5
2024-08-20 15:33:52 +00:00
errors feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
validator feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
worker_pool feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
.gitignore init project 2024-08-20 01:07:16 +08:00
.golangci.yaml feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
Makefile feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
go.work feature/worker_pools (#5) 2024-08-20 15:33:52 +00:00
go.work.sum feature/validator (#4) 2024-08-19 17:21:51 +00:00
readme.md init project 2024-08-20 01:07:16 +08:00

readme.md

golang-common

Current modules

module latest version
error v1.0.0
validator v1.0.0

如何新增Module

假設新增一個module叫 monitoring/grafana

  • init
mkdir -p monitoring/grafana
cd ./monitoring/grafana
go mod init yt.com/backend/common.git/monitoring/grafana
go work use ./monitoring/grafana
  • befor commit

建議測試覆蓋率盡量達到80%

before-commit-check
  • commit
git add ./monitoring/grafana
git commit -m "feat: add monitoring/grafana module"
git tag "monitoring/grafana/v1.0.0"
git push origin monitoring/grafana/v1.0.0
  • launch merge request and codereview

如何使用私有Module

強制git使用ssh方式而不是https:

git config --global --add url."git@code.30cm.net:".insteadOf "https://code.30cm.net/"

# 檢查語法
vim ~/.gitconfig

設定go env

export GOPRIVATE="code.30cm.net"

產生ssh-key 請參考 github ssh , gitlab ssh

add ssh key to the ssh-agent 請參考 Adding your SSH key to the ssh-agent

$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ touch ~/.ssh/config
Host code.30cm.net
  Hostname code.30cm.net
  User Daniel.W
  IdentityFile ~/.ssh/id_rsa
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519

使用 yt.com domain git clone repo

git clone git@code.30cm.net:backend/layout-template.git

在自己repo底下執行:

go clean -modcache
go mod tidy

or
go get -x yt.com/backend/common.git/transport/http/health@1.0.0