mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-10 00:29:01 +02:00
fix api meta proto path
This commit is contained in:
parent
0e0be64cba
commit
86193a2a5f
@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
@ -111,6 +112,13 @@ func (s *Service) listServices() (map[string]*descriptorpb.FileDescriptorSet, er
|
||||
|
||||
func fileDescriptorProto(path string) (*dpb.FileDescriptorProto, error) {
|
||||
fdenc := proto.FileDescriptor(path)
|
||||
// fix proto path
|
||||
if len(fdenc) == 0 {
|
||||
idx := strings.LastIndex(path, "/")
|
||||
if idx > 0 && idx+1 < len(path) {
|
||||
fdenc = proto.FileDescriptor(path[idx+1:])
|
||||
}
|
||||
}
|
||||
fdDep, err := decodeFileDesc(fdenc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user