When i’m tring to create and Adopting Service Discovery with Consul, for my golang microservice projects, consul and grpc conflicts with each other. When it removed grpc issue solved easyliy, but i cannot use updated versions, whay that happens.? does consul have the grpc dependencies.? to cause that.?
error while importing google.golang.org/grpc/status: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/status in multiple modules:
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 (/home/pasan/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status)
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d (/home/pasan/go/pkg/mod/google.golang.org/genproto/googleapis/[email protected]/status)compiler
google.golang.org/grpc
This module is necessary because google.golang.org/grpc is imported in common/api.
i’m tring to add an import as an —
consul "github.com/hashicorp/consul/api"
to create ne registory —
type Registry struct{
client *consul.Client
}
func NewRegistory(addr, serviceName string) (*Registry, error) {
config := consul.DefaultConfig()
config.Address = addr
client, err := consul.NewClient(config)
if err != nil {
return nil, err
}
return &Registry{client}, nil
}
its created using the instructions that have said in
https://www.youtube.com/watch?v=pU_lDwHs9IY
but when its imported auto matically register is unable to create and, when i add the specific package to import consul, its conflicts with grpc
PASAN MADHURANGA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.