Skip to content

Commit

Permalink
fix for issue 312
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Jul 30, 2017
1 parent 95516e4 commit db30a6c
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 633 deletions.
7 changes: 4 additions & 3 deletions plugin/gostring/gostring.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ package gostring

import (
"fmt"
"github.com/gogo/protobuf/gogoproto"
"github.com/gogo/protobuf/protoc-gen-gogo/generator"
"os"
"strconv"
"strings"

"github.com/gogo/protobuf/gogoproto"
"github.com/gogo/protobuf/protoc-gen-gogo/generator"
)

type gostring struct {
Expand Down Expand Up @@ -246,7 +247,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
if field.IsEnum() {
if nullable && !repeated && !proto3 {
goTyp, _ := p.GoType(message, field)
p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, packageName, ".", generator.GoTypeToName(goTyp), `"`, `) + ",\n")`)
p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, generator.GoTypeToName(goTyp), `"`, `) + ",\n")`)
} else {
p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`)
}
Expand Down
12 changes: 6 additions & 6 deletions protoc-gen-gogo/descriptor/descriptor_gostring.gen.go

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

30 changes: 15 additions & 15 deletions test/combos/both/thetest.pb.go

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

30 changes: 15 additions & 15 deletions test/combos/marshaler/thetest.pb.go

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

30 changes: 15 additions & 15 deletions test/combos/unmarshaler/thetest.pb.go

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

Loading

0 comments on commit db30a6c

Please sign in to comment.