aboutsummaryrefslogtreecommitdiff
path: root/examples/README.txt
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 /examples/README.txt
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 'examples/README.txt')
-rw-r--r--examples/README.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/README.txt b/examples/README.txt
index f5530a5e..e6f30370 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -27,3 +27,28 @@ These examples are part of the Protocol Buffers tutorial, located at:
* Note that on some platforms you may have to edit the Makefile and remove
"-lpthread" from the linker commands (perhaps replacing it with something else).
We didn't do this automatically because we wanted to keep the example simple.
+
+## Go ##
+
+The Go example requires a plugin to the protocol buffer compiler, so it is not
+build with all the other examples. See:
+ https://github.com/golang/protobuf
+for more information about Go protocol buffer support.
+
+First, install the the Protocol Buffers compiler (protoc).
+Then, install the Go Protocol Buffers plugin
+($GOPATH/bin must be in your $PATH for protoc to find it):
+ go get github.com/golang/protobuf/protoc-gen-go
+
+Build the Go samples in this directory with "make go". This creates the
+following executable files in the current directory:
+ add_person_go list_people_go
+To run the example:
+ ./add_person_go addressbook.data
+to add a person to the protocol buffer encoded file addressbook.data. The file
+is created if it does not exist. To view the data, run:
+ ./list_people_go addressbook.data
+
+Observe that the C++, Python, and Java examples in this directory run in a
+similar way and can view/modify files created by the Go example and vice
+versa.