#!/bin/bash

dir_resolve()
{
cd "$1" 2>/dev/null || return $?  # cd to desired directory; if fail, quell any error messages but return exit status
echo "`pwd -P`" # output full, link-resolved path
}

set -e

TARGET=`dir_resolve $1`
if [ -z "$TARGET" ]; then
    echo 'USAGE: `generate-go.sh TARGET_PATH`'
    echo ''
    echo 'TARGET_PATH is where you would like the control and events packages to be generated.'
    exit 1
fi

go get github.com/jmtuley/protobuf/{proto,protoc-gen-gogo,gogoproto}

pushd events
mkdir -p $TARGET/events
protoc --plugin=$(which protoc-gen-gogo) --gogo_out=$TARGET/events --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. *.proto
popd

pushd control
mkdir -p $TARGET/control
protoc --plugin=$(which protoc-gen-gogo) --gogo_out=$TARGET/control --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. *.proto
popd

#!/bin/bash

dir_resolve()
{
cd "$1" 2>/dev/null || return $?  # cd to desired directory; if fail, quell any error messages but return exit status
echo "`pwd -P`" # output full, link-resolved path
}

set -e

TARGET=`dir_resolve $1`
if [ -z "$TARGET" ]; then
    echo 'USAGE: `generate-go.sh TARGET_PATH`'
    echo ''
    echo 'TARGET_PATH is where you would like the control and events packages to be generated.'
    exit 1
fi

go get github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto}

pushd events
mkdir -p $TARGET/events
protoc --plugin=$(which protoc-gen-gogo) --gogo_out=$TARGET/events --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. *.proto
popd

pushd control
mkdir -p $TARGET/control
protoc --plugin=$(which protoc-gen-gogo) --gogo_out=$TARGET/control --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. *.proto
popd

--- 
+++ 
@@ -16,7 +16,7 @@
     exit 1
 fi
 
-go get github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto}
+go get github.com/jmtuley/protobuf/{proto,protoc-gen-gogo,gogoproto}
 
 pushd events
 mkdir -p $TARGET/events
Use forked protobuf for generating Go

* Fork provide validation of required fields when marshalling and unmarshalling

[#93439456]

Signed-off-by: John Tuley <b62d404e513eecfa92cb060d3427723b1e04fc4e@pivotal.io>
