wuyin / blog Goto Github PK
View Code? Open in Web Editor NEW个人博客
Home Page: https://yinzige.com
License: MIT License
个人博客
Home Page: https://yinzige.com
License: MIT License
大侠指教一下,我在docker中运行服务报错,原因不明:
当使用MICRO_REGISTRY:mdns时,docker-compose run consignment-service 提示:2018/12/26 03:04:45 failed to serve: Failed to join multicast group on all interfaces!
当使用默认的consul时(consul已在docker中运行,通过http://localhost:8500都能访问到界面 ),提示:2018/12/26 03:09:56 failed to serve: Put http://127.0.0.1:8500/v1/agent/service/register: dial tcp 127.0.0.1:8500: connect: connection refused
.....\pkg\mod\github.com\micro\[email protected]\server\server.go:51:6: invalid receiver type Server (Server is an interface type)
如果是版本问题,请问需要做那些改变了?
博客访问不了了...
博主怎么不用Istio代替go-micro试试?
microservices-part-3-docker-compose-and-mongodb-with-orm.md 该文档中 **mgo 库的 Copy() 与 Clone()**章节中session.Clonse() 拼写错误。
原: edgfbac
应为: edgfbca
如果pulsar server和consumer网络断链,那没有acktimeout回如何处理呢。
在我的机器上运行,我的客户端接收不到返回值。
经过排查后发现,是服务器该端代码导致的
resp = &pb.Response{Created: true, Consignment: consignment}
局部指针赋值给参数指针,在go函数返回的时候,参数指针所指向的地址会变为原地址(即传入时所指向的地址),由此引发局部指针的复制丢失。客户端收到的返回值永远都是一个内容为空的Response结构体指针。
所以只能改为
resp.Created = true
resp.Consignment = consignment
这样赋值,才会运行正常
vendor\google.golang.org\grpc\status\status.go:155:21: cannot use any (type *"peace/vendor/google.golang.org/grpc/vendor/github.com/golang/protobuf/ptypes/any".Any) as type *"github.com/golang/protobuf/ptypes/any".Any in append
vendor\google.golang.org\grpc\status\status.go:169:32: cannot use any (type *"github.com/golang/protobuf/ptypes/any".Any) as type *"peace/vendor/google.golang.org/grpc/vendor/github.com/golang/protobuf/ptypes/any".Any in argument to ptypes.UnmarshalAny
这什么鬼问题啊。
您好,刚刚看到您翻译的那篇《Golang 新手可能会踩的 50 个坑》,觉得写得不错,可以转载到我博客上去吗?会注明出处及链接
博客地址:microservices-part-2-use-go-micro-and-dockerising.md
服务端的CreateConsignment和GetConsignments函数里面有点问题
原代码:
func (s *service) CreateConsignment(ctx context.Context, req *pb.Consignment, resp *pb.Response) error {
// 接收承运的货物
consignment, err := s.repo.Create(req)
if err != nil {
return err
}
resp = &pb.Response{Created: true, Consignment: consignment}
return nil
}
// 获取目前所有托运的货物
// func (s *service) GetConsignments(ctx context.Context, req *pb.GetRequest) (*pb.Response, error) {
func (s *service) GetConsignments(ctx context.Context, req *pb.GetRequest, resp *pb.Response) error {
allConsignments := s.repo.GetAll()
resp = &pb.Response{Consignments: allConsignments}
return nil
}
其中resp = &pb.Response{Created: true, Consignment: consignment}
和resp = &pb.Response{Consignments: allConsignments}
对传入的req重新进行了赋值,地址发生了变化
应该用
resp.Created = true resp.Consignment = consignment
和
resp.Consignments = all
来进行替换
TEG Architecture & Interiors, Branding and Fit Out in Saudi Arabia, Bahrain & Egypt. Engineering speaks Art
“Meant to be your success partner” Professionals provide a comprehensive service and deliverable methodology. Strength is based on humility, constant improvement, stability and continuity, sympathy, trust, originality and on challenges. Currently, the range of specialist, professional services are grouped under the services of “Interiors, Architecture Designs, Branding & Fit-Out”
Simply, TEG Supports its clients.
So, uniqueness is one of the most important aspects in our works. We always stay ahead of time because our work is getting disrupted with the extensive use of technology. So, with a unique design, we also bring the tech-enabled functionalities which will make it easier and useful for the customers. Timely deliverance and adhering to deadlines is also one of our success factors which set us apart from our competitors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.