readme-ko.md
go-zero๋ ๋ค์ํ ์์ง๋์ด๋ง ๋ชจ๋ฒ ์ฌ๋ก๊ฐ ๋ด์ฅ๋ ์น ๋ฐ RPC ํ๋ ์์ํฌ์ ๋๋ค. ํ๋ณต ํ๋ ฅ์ฑ ์ค๊ณ๋ก ํธ๋ํฝ์ด ๋ง์ ์๋น์ค์ ์์ ์ฑ์ ๋ณด์ฅํ๊ธฐ ์ํด ๋ง๋ค์ด์ก์ผ๋ฉฐ, ์๋ ๋์ ์์ฒ๋ง ์ฌ์ฉ์๋ฅผ ๋ณด์ ํ ์ฌ์ดํธ์์ ์ด์๋์ด ์์ต๋๋ค.
<div align=center> </div>English | ็ฎไฝไธญๆ | ํ๊ตญ์ด
<a href="https://trendshift.io/repositories/3263" target="_blank"></a> <a href="https://www.producthunt.com/posts/go-zero?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-go-zero" target="_blank"></a>
go-zero๋ CNCF Landscape์ ๋ฑ์ฌ๋, ๋ค์ํ ์์ง๋์ด๋ง ๋ชจ๋ฒ ์ฌ๋ก๊ฐ ๋ด์ฅ๋ ์น ๋ฐ RPC ํ๋ ์์ํฌ์ ๋๋ค. ํ๋ณต ํ๋ ฅ์ฑ ์ค๊ณ๋ก ํธ๋ํฝ์ด ๋ง์ ์๋น์ค์ ์์ ์ฑ์ ๋ณด์ฅํ๊ธฐ ์ํด ๋ง๋ค์ด์ก์ผ๋ฉฐ, ์๋ ๋์ ์์ฒ๋ง ์ฌ์ฉ์๋ฅผ ๋ณด์ ํ ์ฌ์ดํธ์์ ์ด์๋์ด ์์ต๋๋ค.
go-zero์๋ ๊ฐ๋จํ API ์ค๋ช
๋ฌธ๋ฒ๊ณผ goctl์ด๋ผ๋ ์ฝ๋ ์์ฑ ๋๊ตฌ๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. goctl์ ์ฌ์ฉํ๋ฉด .api ํ์ผ์์ Go, iOS, Android, Kotlin, Dart, TypeScript, JavaScript ์ฝ๋๋ฅผ ์์ฑํ ์ ์์ต๋๋ค.
2018๋ ์ด, ์ฐ๋ฆฌ๋ Java+MongoDB ๊ธฐ๋ฐ ๋ชจ๋๋ฆฌ์ ์ํคํ ์ฒ์์ ๋ง์ดํฌ๋ก์๋น์ค๋ก ์ ํํ๋ฉด์ ๋ค์์ ์ ํํ์ต๋๋ค.
go-zero๋ ๋ค์ ํต์ฌ ์ค๊ณ ์์น์ ๋ฐ๋ฆ ๋๋ค.
go-zero๋ ์์ง๋์ด๋ง ๋ชจ๋ฒ ์ฌ๋ก๋ฅผ ํตํฉํฉ๋๋ค.
ํ๋ก์ ํธ์์ ๋ค์ ๋ช ๋ น์ ์คํํ์ธ์.
go get -u github.com/zeromicro/go-zero
go-zero ํ์ Claude, GitHub Copilot, Cursor๊ฐ ํ๋ ์์ํฌ ๊ท์น์ ๋ฐ๋ฅด๋ ์ฝ๋๋ฅผ ์์ฑํ ์ ์๋๋ก AI ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค.
ai-context - AI ์ด์์คํดํธ๋ฅผ ์ํ ์ํฌํ๋ก ๊ฐ์ด๋
zero-skills - ์์ ๊ฐ ํฌํจ๋ ํจํด ๋ผ์ด๋ธ๋ฌ๋ฆฌ
mcp-zero - Model Context Protocol์ ํตํ ์ฝ๋ ์์ฑ ๋๊ตฌ
git submodule add https://github.com/zeromicro/ai-context.git .github/ai-context
ln -s ai-context/00-instructions.md .github/copilot-instructions.md # macOS/Linux
# Windows: mklink .github\copilot-instructions.md .github\ai-context\00-instructions.md
git submodule update --remote .github/ai-context # ์
๋ฐ์ดํธ
git submodule add https://github.com/zeromicro/ai-context.git .cursorrules
git submodule update --remote .cursorrules # ์
๋ฐ์ดํธ
git submodule add https://github.com/zeromicro/ai-context.git .windsurfrules
git submodule update --remote .windsurfrules # ์
๋ฐ์ดํธ
git clone https://github.com/zeromicro/mcp-zero.git && cd mcp-zero && go build
# ์ค์ : ~/Library/Application Support/Claude/claude_desktop_config.json
# ๋๋: claude mcp add --transport stdio mcp-zero --env GOCTL_PATH=/path/to/goctl -- /path/to/mcp-zero
AI ์ด์์คํดํธ๋ ๋ค์ ๋๊ตฌ๋ฅผ ํจ๊ป ์ฌ์ฉํฉ๋๋ค.
์์: REST API ์์ฑ โ AI๊ฐ ai-context์์ ์ํฌํ๋ก๋ฅผ ์ฝ์ โ mcp-zero๋ฅผ ํธ์ถํด ์ฝ๋ ์์ฑ โ zero-skills์์ ํจํด ์ฐธ์กฐ โ ํ๋ก๋์ ์ค๋น๊ฐ ๋ ์ฝ๋ ์์ฑ โ
์ ์ฒด ์์ :
goctl ์ค์น
# Go ์ฌ์ฉ
go install github.com/zeromicro/go-zero/tools/goctl@latest
# Mac ์ฌ์ฉ
brew install goctl
# ๋ชจ๋ ํ๋ซํผ์์ docker ์ฌ์ฉ
docker pull kevinwan/goctl
# goctl ์คํ
docker run --rm -it -v `pwd`:/app kevinwan/goctl --help
goctl์ด ์คํ ๊ฐ๋ฅํ๊ณ $PATH์ ํฌํจ๋์ด ์๋์ง ํ์ธํ์ธ์.
API ํ์ผ(greet.api) ์์ฑ:
type (
Request {
Name string `path:"name,options=[you,me]"` // ํ๋ผ๋ฏธํฐ๋ ์๋์ผ๋ก ๊ฒ์ฆ๋ฉ๋๋ค.
}
Response {
Message string `json:"message"`
}
)
service greet-api {
@handler GreetHandler
get /greet/from/:name(Request) returns (Response)
}
.api ํ ํ๋ฆฟ ์์ฑ:
goctl api -o greet.api
Go ์๋ฒ ์ฝ๋ ์์ฑ
goctl api go -api greet.api -dir greet
์์ฑ๋๋ ๊ตฌ์กฐ:
โโโ greet
โย ย โโโ etc
โย ย โย ย โโโ greet-api.yaml // ์ค์ ํ์ผ
โย ย โโโ greet.go // main ํ์ผ
โย ย โโโ internal
โย ย โโโ config
โย ย โย ย โโโ config.go // ์ค์ ์ ์
โย ย โโโ handler
โย ย โย ย โโโ greethandler.go // get/put/post/delete ๋ผ์ฐํธ๊ฐ ์ฌ๊ธฐ์ ์ ์๋ฉ๋๋ค.
โย ย โย ย โโโ routes.go // ๋ผ์ฐํธ ๋ชฉ๋ก
โย ย โโโ logic
โย ย โย ย โโโ greetlogic.go // ์์ฒญ ๋ก์ง์ ์ฌ๊ธฐ์ ์์ฑํ ์ ์์ต๋๋ค.
โย ย โโโ svc
โย ย โย ย โโโ servicecontext.go // ์๋น์ค ์ปจํ
์คํธ, mysql/redis๋ฅผ ์ฌ๊ธฐ์ ์ ๋ฌํ ์ ์์ต๋๋ค.
โย ย โโโ types
โย ย โโโ types.go // ์์ฒญ/์๋ต์ด ์ฌ๊ธฐ์ ์ ์๋ฉ๋๋ค.
โโโ greet.api // api ์ค๋ช
ํ์ผ
์๋น์ค ์คํ:
cd greet
go mod tidy
go run greet.go -f etc/greet-api.yaml
๊ธฐ๋ณธ ํฌํธ: 8888(etc/greet-api.yaml์์ ๋ณ๊ฒฝ ๊ฐ๋ฅ)
curl๋ก ํ ์คํธ:
curl -i http://localhost:8888/greet/from/you
์๋ต:
HTTP/1.1 200 OK
Date: Sun, 30 Aug 2020 15:32:35 GMT
Content-Length: 0
๋น์ฆ๋์ค ๋ก์ง ์์ฑ
์ฌ๋ฌ ์ธ์ด์ ํด๋ผ์ด์ธํธ ์ฝ๋ ์์ฑ
goctl api java -api greet.api -dir greet
goctl api dart -api greet.api -dir greet
...
๋ค์ ๋งํฌ์์ ์ฑํ ์ ์ฐธ์ฌํ์ธ์: https://discord.gg/4JQvC5A4Fe
go-zero๋ CNCF Cloud Native Landscape์ ๋ฑ์ฌ๋์์ต๋๋ค.
์ด ํ๋ก์ ํธ๊ฐ ๋ง์์ ๋ค๊ฑฐ๋ ํ์ต ๋๋ ์์ฒด ์๋ฃจ์ ์ ์์ํ๋ ๋ฐ ์ฌ์ฉ ์ค์ด๋ผ๋ฉด, ์ ๋ฆด๋ฆฌ์ค ์ ๋ฐ์ดํธ๋ฅผ ๋ฐ์ ์ ์๋๋ก star๋ฅผ ๋๋ฌ์ฃผ์ธ์. ์ฌ๋ฌ๋ถ์ ์ง์์ ํฐ ํ์ด ๋ฉ๋๋ค!