• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

topfreegames / pitaya / 10187728597

31 Jul 2024 09:11PM UTC coverage: 58.588% (-0.6%) from 59.186%
10187728597

Pull #414

github

felipejfc
remove: grpc e2e tests from ci
Pull Request #414: Remove grpc rpc

7 of 35 new or added lines in 2 files covered. (20.0%)

3 existing lines in 1 file now uncovered.

4673 of 7976 relevant lines covered (58.59%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.61
/pkg/docgenerator/descriptors.go
1
package docgenerator
2

3
import (
4
        "strings"
5

6
        "github.com/topfreegames/pitaya/v3/pkg/constants"
7
        "google.golang.org/protobuf/proto"
8
        "google.golang.org/protobuf/reflect/protodesc"
9
        "google.golang.org/protobuf/reflect/protoreflect"
10
        "google.golang.org/protobuf/reflect/protoregistry"
11
)
12

13
// ProtoDescriptors returns the descriptor for a given message name or .proto file
14
func ProtoDescriptors(protoName string) ([]byte, error) {
1✔
15
        if strings.HasSuffix(protoName, ".proto") {
2✔
16
                descriptor, _ := protoregistry.GlobalFiles.FindFileByPath(protoName)
1✔
17
                if descriptor == nil {
2✔
18
                        return nil, constants.ErrProtodescriptor
1✔
19
                }
1✔
20

21
                desc, err := proto.Marshal(protodesc.ToFileDescriptorProto(descriptor))
1✔
22
                if err != nil {
1✔
NEW
23
                        return nil, constants.ErrProtodescriptor
×
NEW
24
                }
×
25
                return desc, nil
1✔
26
        }
27

28
        if strings.HasPrefix(protoName, "types.") {
1✔
29
                protoName = strings.Replace(protoName, "types.", "google.protobuf.", 1)
×
30
        }
×
31

32
        protoReflectTypePointer, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(protoName))
1✔
33
        if protoReflectTypePointer == nil {
2✔
34
                return nil, constants.ErrProtodescriptor
1✔
35
        }
1✔
36

37
        protoReflectType := protoReflectTypePointer.Descriptor()
1✔
38

1✔
39
        protoDescriptor, _ := proto.Marshal(protodesc.ToDescriptorProto(protoReflectType))
1✔
40

1✔
41
        return protoDescriptor, nil
1✔
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc