refactor: relocate protoapi stub files to examples/grpcentity/protoapi

This commit is contained in:
2026-07-17 16:37:06 +09:00
parent 5408a70118
commit 044f0e4d42
6 changed files with 611 additions and 7 deletions
+5 -3
View File
@@ -166,11 +166,13 @@ gRPC 개발 환경을 구축하기 위해 설치하는 세 가지 프로그램
```
### 4.3 실제로 번역하기 (컴파일 명령어)
아래 명령어는 컴퓨터에게 **"내가 작성한 `protoapi.proto` 약속 장부를 Go 언어로 번역해서 `protoapi/` 폴더에 가지런히 넣어줘!"** 하고 지시하는 마법의 명령어입니다:
아래 명령어는 컴퓨터에게 **"내가 작성한 `protoapi.proto` 약속 장부를 Go 언어로 번역해서 현재 실습 디렉터리 내부의 `protoapi/` 폴더에 가지런히 넣어줘!"** 하고 지시하는 마법의 명령어입니다:
```bash
protoc --go_out=. --go-grpc_out=. examples/grpcentity/protoapi.proto
# 실습 디렉터리로 이동한 후 컴파일 실행
cd examples/grpcentity
protoc --go_out=. --go-grpc_out=. protoapi.proto
```
명령을 실행하고 나면 `protoapi/` 폴더 하위에 다음 두 파일이 기분 좋게 생성됩니다:
명령을 실행하고 나면 해당 폴더 내의 `protoapi/` 폴더 하위에 다음 두 파일이 기분 좋게 생성됩니다:
* `protoapi.pb.go`: 약속 문서에 적은 데이터(Message) 규격들을 Go 구조체로 변환해 놓은 파일입니다.
* `protoapi_grpc.pb.go`: 기기와 서버가 실제로 요청을 주고받을 수 있게 하는 통신 창구(Service) 함수가 자동 완성된 파일입니다.