File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# Run this script from its directory, so that badgerpb4.proto is where it's expected to
4- # be.
4+ # be. Only run this script if you've made changes to the API in badgerpb4.proto.
5+
6+ # Check if protoc version matches expected version first
7+ EXPECTED_PROTOC_VERSION=" 3.21.12"
8+ ACTUAL_PROTOC_VERSION=$( protoc --version 2> /dev/null | grep -o ' [0-9]\+\.[0-9]\+\.[0-9]\+' )
9+
10+ if [[ ${ACTUAL_PROTOC_VERSION} != " ${EXPECTED_PROTOC_VERSION} " ]]; then
11+ echo " Warning: protoc version mismatch"
12+ echo " Expected: ${EXPECTED_PROTOC_VERSION} "
13+ echo " Actual: ${ACTUAL_PROTOC_VERSION:- ' not found' } "
14+ echo " Skipping generation"
15+ exit 0
16+ fi
517
618go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
19+
20+ # Get the GOPATH and add the bin directory to PATH
21+ GOPATH=$( go env GOPATH)
22+ export PATH=" ${GOPATH} /bin:${PATH} "
23+
724protoc --go_out=. --go_opt=paths=source_relative badgerpb4.proto
You can’t perform that action at this time.
0 commit comments