From 1fe528c411a0d0a32793e2710a91b60e19bf8fae Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 28 Feb 2018 15:38:50 +0000 Subject: [PATCH] update readme --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index dc34a8fc..26e6a039 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,23 @@ Watch the [Golang UK Conf 2016](https://www.youtube.com/watch?v=xspaDovwk34) vid ## Getting started +- [Install Protobuf](#install-protobuf) - [Service Discovery](#service-discovery) - [Writing a Service](#writing-a-service) - [Writing a Function](#writing-a-function) - [Plugins](#plugins) - [Wrappers](#wrappers) +## Install Protobuf + +Protobuf is required for code generation + +You'll need to install: + +- [protoc](https://github.com/google/protobuf) +- [protoc-gen-go](https://github.com/golang/protobuf) +- [protoc-gen-micro](https://github.com/micro/protoc-gen-micro) + ## Service Discovery Service discovery is used to resolve service names to addresses. It's the only dependency of go-micro. @@ -91,23 +102,12 @@ message HelloResponse { } ``` -### Install protobuf - -Install [protobuf](https://developers.google.com/protocol-buffers/) - -Now install the micro fork of protoc-gen-go. The protobuf compiler for Go. - -```shell -go get github.com/micro/protobuf/{proto,protoc-gen-go} -``` - ### Generate the proto After writing the proto definition we must compile it using protoc with the micro plugin. ```shell -protoc -I$GOPATH/src --go_out=plugins=micro:$GOPATH/src \ - $GOPATH/src/github.com/micro/examples/service/proto/greeter.proto +protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. path/to/greeter.proto ``` ### Write the service @@ -191,6 +191,7 @@ import ( func main() { // Create a new service. Optionally include some options here. service := micro.NewService(micro.Name("greeter.client")) + service.Init() // Create new greeter client greeter := proto.NewGreeterClient("greeter", service.Client())