#!/bin/bash set -e # Check if protoc is installed if ! command -v protoc &> /dev/null; then echo "Error: protoc is not installed" echo "Install with: apt-get install -y protobuf-compiler" exit 1 fi # Check if protoc-gen-go is installed if ! command -v protoc-gen-go &> /dev/null; then echo "Installing protoc-gen-go..." go install google.golang.org/protobuf/cmd/protoc-gen-go@latest fi # Check if protoc-gen-go-grpc is installed if ! command -v protoc-gen-go-grpc &> /dev/null; then echo "Installing protoc-gen-go-grpc..." go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest fi echo "Generating protobuf files..." # Generate Go code from proto files protoc --go_out=. --go_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ pkg/grpc/proto/proxy.proto echo "Proto generation complete!"