Skip to content

Commit b65657f

Browse files
authored
[Proto] Make protoFileInfo method public (#1998)
Summary: In this commit, we make the protoFileInfo method public so that users interested in parsing the proto files can use the method directly. <!-- Thanks for sending a PR! Before submitting: 1. If this is your first PR, please read CONTRIBUTING.md and sign the CLA first. We cannot review code without a signed CLA. 2. Please file an issue *first*. All features and most bug fixes should have an associated issue with a design discussed and decided upon. Small bug fixes and documentation improvements don't need issues. 3. New features and bug fixes must have tests. Documentation may need to be updated. If you're unsure what to update, send the PR, and we'll discuss in review. --> **What type of PR is this?** Other **What package or component does this PR mostly affect?** language/proto **What does this PR do? Why is it needed?** This PR makes a previously private method public so it can be reused to parse proto files **Which issues(s) does this PR fix?** Fixes # **Other notes for review**
1 parent ed07aa8 commit b65657f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

language/proto/fileinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type Option struct {
5050

5151
var protoRe = buildProtoRegexp()
5252

53-
func protoFileInfo(dir, name string) FileInfo {
53+
func ProtoFileInfo(dir, name string) FileInfo {
5454
info := FileInfo{
5555
Path: filepath.Join(dir, name),
5656
Name: name,

language/proto/fileinfo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ import "second.proto";`,
233233
t.Fatal(err)
234234
}
235235

236-
got := protoFileInfo(dir, tc.name)
236+
got := ProtoFileInfo(dir, tc.name)
237237

238238
// Clear fields we don't care about for testing.
239239
got = FileInfo{

language/proto/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func RuleName(names ...string) string {
119119
func buildPackages(pc *ProtoConfig, dir, rel string, protoFiles, genFiles []string) []*Package {
120120
packageMap := make(map[string]*Package)
121121
for _, name := range protoFiles {
122-
info := protoFileInfo(dir, name)
122+
info := ProtoFileInfo(dir, name)
123123
key := info.PackageName
124124

125125
if pc.Mode == FileMode {

0 commit comments

Comments
 (0)