Skip to content

Commit

Permalink
Merge pull request #78 from gengo/fix/golint
Browse files Browse the repository at this point in the history
Add abstraction of code generator implementation
  • Loading branch information
yugui committed Dec 24, 2015
2 parents 714a8df + dcb9529 commit b56786c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions protoc-gen-grpc-gateway/generator/generator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Package generator provides an abstract interface to code generators.
package generator

import (
"github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
)

// Generator is an abstraction of code generators.
type Generator interface {
// Generate generates output files from input .proto files.
Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error)
}
3 changes: 2 additions & 1 deletion protoc-gen-grpc-gateway/gengateway/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
gen "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/generator"
"github.com/golang/glog"
"github.com/golang/protobuf/proto"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
Expand All @@ -24,7 +25,7 @@ type generator struct {
}

// New returns a new generator which generates grpc gateway files.
func New(reg *descriptor.Registry) *generator {
func New(reg *descriptor.Registry) gen.Generator {
var imports []descriptor.GoPackage
for _, pkgpath := range []string{
"encoding/json",
Expand Down

0 comments on commit b56786c

Please sign in to comment.