github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/scripts/proto_gen_go.sh (about)

     1  #!/usr/bin/env bash
     2  SCRIPTS_DIR=$(dirname "$0")
     3  
     4  PROTO_DIR=$SCRIPTS_DIR/../internal/proto
     5  MILVUS_PROTO_DIR=$SCRIPTS_DIR/../internal/milvus-proto
     6  
     7  PROGRAM=$(basename "$0")
     8  GOPATH=$(go env GOPATH)
     9  
    10  if [ -z $GOOGLE_PROTOPATH ]; then
    11      printf "Error: path to google proto not defined, please export GOOGLE_PROTOPATH before running this script"
    12      exit 1
    13  fi
    14  
    15  if [ -z $GOPATH ]; then
    16      printf "Error: GOPATH cannot be found, please set it before running this script"
    17      exit 1
    18  fi
    19  
    20  case ":$PATH:" in
    21      *":$GOPATH/bin:"*) ;;
    22      *) export PATH="$GOPATH/bin:$PATH";;
    23  esac
    24  
    25  echo "updating module-proto submodule"
    26  git submodule update --init
    27  
    28  echo "using protoc-gen-go: $(which protoc-gen-go)"
    29  
    30  mkdir -p ${PROTO_DIR}/common
    31  mkdir -p ${PROTO_DIR}/server
    32  mkdir -p ${PROTO_DIR}/milvus
    33  
    34  protoc --proto_path=${MILVUS_PROTO_DIR}/proto \
    35      --proto_path=${GOOGLE_PROTOPATH} \
    36      --go_opt="Mmilvus.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/server;server" \
    37      --go_opt=Mcommon.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/common \
    38      --go_opt=Mschema.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/schema \
    39      --go_out=plugins=grpc,paths=source_relative:${PROTO_DIR}/server ${MILVUS_PROTO_DIR}/proto/milvus.proto
    40  protoc --proto_path=${MILVUS_PROTO_DIR}/proto \
    41      --proto_path=${GOOGLE_PROTOPATH} \
    42      --go_opt=Mmilvus.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/server \
    43      --go_opt="Mcommon.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/common;common" \
    44      --go_opt=Mschema.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/schema \
    45      --go_out=plugins=grpc,paths=source_relative:${PROTO_DIR}/common ${MILVUS_PROTO_DIR}/proto/common.proto
    46  protoc --proto_path=${MILVUS_PROTO_DIR}/proto \
    47      --proto_path=${GOOGLE_PROTOPATH} \
    48      --go_opt=Mmilvus.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/server \
    49      --go_opt=Mcommon.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/common \
    50      --go_opt="Mschema.proto=github.com/milvus-io/milvus-sdk-go/v2/internal/proto/schema;schema" \
    51      --go_out=plugins=grpc,paths=source_relative:${PROTO_DIR}/schema ${MILVUS_PROTO_DIR}/proto/schema.proto
    52