Skip to content

Commit 6818d9f

Browse files
authored
Merge pull request #66 from envelope-org/fix/issue-63
fixed support for a custom-defined package names via option go_package
2 parents 156a30b + 5513161 commit 6818d9f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

protoc-gen-graphql/spec/file.go

+3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ func (f *File) messagesRecursive(d *descriptor.DescriptorProto, prefix []string,
9494
return messages
9595
}
9696

97+
// Package is a package name retrieved from protobuf's package keyword
9798
func (f *File) Package() string {
9899
return f.descriptor.GetPackage()
99100
}
100101

102+
// GoPackage will search for an option named go_package and, if found, returns it.
103+
// Otherwise, it calls Package
101104
func (f *File) GoPackage() string {
102105
var pkgName string
103106
if opt := f.descriptor.GetOptions(); opt == nil {

protoc-gen-graphql/spec/package.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewPackage(g PackageGetter) *Package {
3131
p.FileName = filepath.Base(p.GeneratedFilenamePrefix)
3232

3333
if pkg := g.GoPackage(); pkg != "" {
34-
// Support custom package definitions like example.com/path/to/package:packageName
34+
// Support custom package definitions like example.com/path/to/package;packageName
3535
if index := strings.Index(pkg, ";"); index > -1 {
3636
p.Name = pkg[index+1:]
3737
p.Path = pkg[0:index]

protoc-gen-graphql/template.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)