go micro helloworld 问题记录

lidashuang · · 908 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

Missing 'go_package' option

protoc --proto_path=. --micro_out=Mproto/imports/api.proto=github.com/micro/go-micro/v2/api/proto:. --go_out=Mproto/imports/api.proto=github.com/micro/go-micro/v2/api/proto:. proto/helloworld/helloworld.proto
2020/07/03 12:24:58 WARNING: Missing 'go_package' option in "proto/helloworld/helloworld.proto",
please specify it with the full Go package path as
a future release of protoc-gen-go will require this be specified.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.

image.png

option go_package = "proto/helloworld";

undefined: balancer.PickOptions

# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
../../go/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
../../go/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
../../go/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
../../go/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

https://segmentfault.com/q/10...

micro env

env Get/set micro cli environment

 $ micro env
  local      none
* server     127.0.0.1:8081
  platform   proxy.m3o.com  
# set to use server
micro env set server

grpc api 和 http api 映射

https://m3o.com/docs/go-api.h...

比如 rpc call 如下

micro call go.micro.service.posts Posts.Query '{"slug":"how-to-micro"}'

对于http请求可以用 /rpc
参数 service, method, request

## post
curl -X "POST" "http://127.0.0.1:8082/rpc" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "service": "go.micro.service.posts",
  "": "Posts.Query",
  "request": {
    "slug": "how-to-micro"
  }
}'

有疑问加站长微信联系(非本文作者)

本文来自:Segmentfault

感谢作者:lidashuang

查看原文:go micro helloworld 问题记录

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:701969077

908 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传