aboutsummaryrefslogtreecommitdiff
path: root/travis.sh
diff options
context:
space:
mode:
authorTim Swast <swast@google.com>2015-11-20 15:32:53 -0800
committerTim Swast <swast@google.com>2015-11-25 10:46:35 -0800
commit7e31c4d930efa3f80d0f03c93e788ba73b847fd8 (patch)
tree9e3980cce5ad25c42e013b51d28d503cd4b7891c /travis.sh
parentf1e14fba2300010d6f2966b2e32d4aa0842cdffb (diff)
downloadprotobuf-7e31c4d930efa3f80d0f03c93e788ba73b847fd8.tar.gz
protobuf-7e31c4d930efa3f80d0f03c93e788ba73b847fd8.tar.bz2
protobuf-7e31c4d930efa3f80d0f03c93e788ba73b847fd8.zip
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.
Diffstat (limited to 'travis.sh')
-rwxr-xr-xtravis.sh18
1 files changed, 18 insertions, 0 deletions
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