Skip to content

Commit

Permalink
Merge pull request #126 from gengo/fix/govet
Browse files Browse the repository at this point in the history
Fix govet errors
  • Loading branch information
yugui committed Mar 23, 2016
2 parents 6a84588 + dd88c73 commit 965b62d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 4 additions & 0 deletions examples/examplepb/a_bit_of_everything.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions examples/examplepb/echo_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions examples/examplepb/flow_combination.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions protoc-gen-swagger/genswagger/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,23 @@ func TestApplyTemplateSimple(t *testing.T) {
got := new(swaggerObject)
err = json.Unmarshal([]byte(result), got)
if err != nil {
t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err)
t.Errorf("json.Unmarshal(%s) failed with %v; want success", result, err)
return
}
if want, is, name := "2.0", got.Swagger, "Swagger"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := "", got.BasePath, "BasePath"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := []string{"http", "https"}, got.Schemes, "Schemes"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := []string{"application/json"}, got.Consumes, "Consumes"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := []string{"application/json"}, got.Produces, "Produces"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}

// If there was a failure, print out the input and the json result for debugging.
Expand Down Expand Up @@ -247,29 +247,29 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) {
t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err)
return
}
got := new(swaggerObject)
err = json.Unmarshal([]byte(result), got)
var obj swaggerObject
err = json.Unmarshal([]byte(result), &obj)
if err != nil {
t.Errorf("applyTemplate(%#v) failed with %v; want success", file, err)
return
}
if want, is, name := "2.0", got.Swagger, "Swagger"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
if want, got := "2.0", obj.Swagger; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).Swagger = %s want to be %s", file, got, want)
}
if want, is, name := "", got.BasePath, "BasePath"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
if want, got := "", obj.BasePath; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).BasePath = %s want to be %s", file, got, want)
}
if want, is, name := []string{"http", "https"}, got.Schemes, "Schemes"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
if want, got := []string{"http", "https"}, obj.Schemes; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).Schemes = %s want to be %s", file, got, want)
}
if want, is, name := []string{"application/json"}, got.Consumes, "Consumes"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
if want, got := []string{"application/json"}, obj.Consumes; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).Consumes = %s want to be %s", file, got, want)
}
if want, is, name := []string{"application/json"}, got.Produces, "Produces"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", file, name, is, want)
if want, got := []string{"application/json"}, obj.Produces; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).Produces = %s want to be %s", file, got, want)
}
if want, is, name := "Generated for ExampleService.Echo - ", got.Paths["/v1/echo"].Post.Summary, "Paths[/v1/echo].Post.Summary"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(file).%s = %s want to be %s", name, is, want)
if want, got, name := "Generated for ExampleService.Echo - ", obj.Paths["/v1/echo"].Post.Summary, "Paths[/v1/echo].Post.Summary"; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, got, want)
}

// If there was a failure, print out the input and the json result for debugging.
Expand Down

0 comments on commit 965b62d

Please sign in to comment.