카테고리 없음

TIL 07082022 - GO 2

2cho6 2022. 7. 14. 10:09

strconv - package that implements conversions to and from string representations of basic data types.

(most common - Atoi (string to int) and Itoa (int to string))

 

* Macbook M1에서는 GRPC를 위한 Protobuf 설치에 문제가 있음.

따라서 소스를 내려 받은 후에 로컬에서 컴파일 하는 과정을 거치는 것이 안전한 방법.

 

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

export PATH=/opt/homebrew/bin:$PATH git clone https://github.com/protocolbuffers/protobuf.git

arch -arm64 brew install autoconf

arch -arm64 brew install automake

arch -arm64 brew install Libtool

cd protobuf

autoreconf -i

./autogen.sh

./configure

make

make check

sudo make install

export PATH=/opt/usr/local/bin:$PATH

 

(golang 사용시 추가할 것)

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

 

* build_proto.sh 작성 시 경로가 조금 다르다

#!/bin/bash
cd ./internal
protoc -I ./proto \
    --grpc-gateway_out ./ \
    --go_out=./ ./proto/v1/answers/answers.proto \
    --go-grpc_out=./ \

cd -
go build ./cmd/dtx-api-diary-go