From 7e31c4d930efa3f80d0f03c93e788ba73b847fd8 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 20 Nov 2015 15:32:53 -0800 Subject: Add a Go language example. This follows the other examples so that it can be used as a tutorial, such as the ones at: https://developers.google.com/protocol-buffers/docs/tutorials Even though Go generally does not use Makefiles, I added targets for the Go examples to be consistent with the other languages. Edit: Fix Travis run. Change to use $HOME instead of ~. Add protoc to path. GOPATH entry cannot start with shell metacharacter '~': "~/gocode" Edit(2): Fix Go code style to address comments. --- travis.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'travis.sh') diff --git a/travis.sh b/travis.sh index 459f83f5..6295336b 100755 --- a/travis.sh +++ b/travis.sh @@ -47,6 +47,24 @@ build_csharp() { cd conformance && make test_csharp && cd .. } +build_golang() { + # Go build needs `protoc`. + internal_build_cpp + # Add protoc to the path so that the examples build finds it. + export PATH="`pwd`/src:$PATH" + + # Install Go and the Go protobuf compiler plugin. + sudo apt-get update -qq + sudo apt-get install -qq golang + export GOPATH="$HOME/gocode" + mkdir -p "$GOPATH/src/github.com/google" + ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" + export PATH="$GOPATH/bin:$PATH" + go get github.com/golang/protobuf/protoc-gen-go + + cd examples && make gotest && cd .. +} + use_java() { version=$1 case "$version" in -- cgit v1.2.3