Skip to content

Commit

Permalink
properly respect file flag for protoc-gen-swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
tmc committed Jan 9, 2017
1 parent 13a87db commit 1841772
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions protoc-gen-swagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var (
importPrefix = flag.String("import_prefix", "", "prefix to be added to go package paths for imported proto files")
file = flag.String("file", "stdin", "where to load data from")
file = flag.String("file", "-", "where to load data from")
)

func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) {
Expand All @@ -43,8 +43,11 @@ func main() {

glog.V(1).Info("Processing code generator request")
f := os.Stdin
if *file != "stdin" {
f, _ = os.Open("input.txt")
if *file != "-" {
f, err := os.Open(*file)
if err != nil {
glog.Fatal(err)
}
}
req, err := parseReq(f)
if err != nil {
Expand Down

0 comments on commit 1841772

Please sign in to comment.