Skip to content

Commit

Permalink
try (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
btc authored May 23, 2018
1 parent 8d5bf6a commit f3b83fc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ func (g *gatherer) Generate(f *generator.FileDescriptor) {

func (g *gatherer) hydratePackage(f *generator.FileDescriptor, comments map[string]string) Package {
// TODO(btc): perhaps return error with specific info about failure
importPath, name, found := goPackageOption(f)
if !found {
path := goImportPath(g.Generator.Unwrap(), f)
name = string(g.Generator.GoPackageName(path))
importPath = string(path)
importPath := goImportPath(g.Generator.Unwrap(), f)
name := string(g.Generator.GoPackageName(importPath))
if p, n, found := goPackageOption(f); found {
if p != "" {
importPath = generator.GoImportPath(p)
}
if n != "" {
name = n
}
}

g.push("package:" + name)
Expand Down Expand Up @@ -83,7 +87,7 @@ func (g *gatherer) hydratePackage(f *generator.FileDescriptor, comments map[stri
p := &pkg{
fd: f,
name: name,
importPath: importPath,
importPath: string(importPath),
comments: pcomments,
}

Expand Down

0 comments on commit f3b83fc

Please sign in to comment.