Skip to content

Commit 911c540

Browse files
committed
re
1 parent 2031d73 commit 911c540

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

internal/protoschema/plugin/pluginsourceinfo/pluginsourceinfo.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ func GetSourceInfoPath(fileDescriptor protoreflect.FileDescriptor) string {
3434
return fmt.Sprintf("%s%s", path, FileExtension)
3535
}
3636

37+
func GenFileContents(fileDescriptor protoreflect.FileDescriptor) ([]byte, error) {
38+
// Convert the file descriptor to a descriptorpb.FileDescriptorProto.
39+
fileDescProto := protodesc.ToFileDescriptorProto(fileDescriptor)
40+
return proto.Marshal(fileDescProto.SourceCodeInfo)
41+
}
42+
3743
// Handle implements protoplugin.Handler and is the main entry point for the plugin.
3844
func Handle(
3945
_ context.Context,
@@ -58,9 +64,3 @@ func Handle(
5864
responseWriter.SetFeatureProto3Optional()
5965
return nil
6066
}
61-
62-
func GenFileContents(fileDescriptor protoreflect.FileDescriptor) ([]byte, error) {
63-
// Convert the file descriptor to a descriptorpb.FileDescriptorProto.
64-
fileDescProto := protodesc.ToFileDescriptorProto(fileDescriptor)
65-
return proto.Marshal(fileDescProto.SourceCodeInfo)
66-
}

sourceinfo/sourceinfo.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ import (
3030
)
3131

3232
var (
33-
// SourceInfoGlobalTypes is a replacement for protoregistry.GlobalTypes that includes
33+
// GlobalTypes is a replacement for protoregistry.GlobalTypes that includes
3434
// all registered source info.
3535
GlobalFiles protodesc.Resolver = sourceinfo.GlobalFiles
3636

37-
// SourceInfoGlobalFiles is a replacement for protoregistry.GlobalFiles that includes
37+
// GlobalFiles is a replacement for protoregistry.GlobalFiles that includes
3838
// all registered source info.
3939
GlobalTypes interface {
4040
protoregistry.MessageTypeResolver
@@ -43,12 +43,12 @@ var (
4343
} = sourceinfo.GlobalTypes
4444
)
4545

46-
// RegisterAllSourceInfo registers all sourceinfo files under the given output path.
46+
// RegisterAll registers all sourceinfo files under the given output path.
4747
func RegisterAll(root string) error {
4848
return RegisterAllFS(os.DirFS(root), ".")
4949
}
5050

51-
// RegisterAllSourceInfoFS registers all sourceinfo files under the given output path, using the given fs.FS.
51+
// RegisterAllFS registers all sourceinfo files under the given output path, using the given fs.FS.
5252
func RegisterAllFS(fsys fs.FS, root string) error {
5353
return fs.WalkDir(fsys, root, func(path string, d fs.DirEntry, err error) error {
5454
if err != nil {

0 commit comments

Comments
 (0)