Skip to content

Commit

Permalink
Use bool for sourceRelativePaths instead of string
Browse files Browse the repository at this point in the history
Initial commit was threading the string value through the system
Now, we just interperet the option up front and use as a bool in
later parts
  • Loading branch information
dbudworth committed Sep 19, 2018
1 parent 9e9229a commit eddc651
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions protoc-gen-twirp/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type twirp struct {
importMap map[string]string // Mapping from .proto file name to import path.

// Package output:
paths string // instruction on where to write output files
sourceRelativePaths bool // instruction on where to write output files

// Package naming:
genPkgName string // Name of the package that we're generating
Expand Down Expand Up @@ -85,7 +85,7 @@ func (t *twirp) Generate(in *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorR

t.genFiles = gen.FilesToGenerate(in)

t.paths = params.paths
t.sourceRelativePaths = params.paths == "source_relative"

// Collect information on types.
t.reg = typemap.New(in.ProtoFile)
Expand Down
2 changes: 1 addition & 1 deletion protoc-gen-twirp/go_naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (t *twirp) goFileName(f *descriptor.FileDescriptorProto) string {
name = name[:len(name)-len(ext)]
}
name += ".twirp.go"
if t.paths == "source_relative" {
if t.sourceRelativePaths {
return name
}
// Does the file have a "go_package" option? If it does, it may override the
Expand Down

0 comments on commit eddc651

Please sign in to comment.