Skip to content

Commit bbd03ef

Browse files
Chris Manghanedsnet
authored andcommitted
proto, protoc-gen-go: fix vet and gofmt errors for Go 1.10 (#508)
In Go 1.10, go vet and gofmt have changed their output in a way to breaks the current build and test cycle. gofmt turns a one-line definition of a single-method interface into three lines; this causes a golden comparison test to produce different results between Go 1.9 and Go 1.10. go vet is now run by default with go test, which uncovered a bad Stringer argument in extension_test.go. Tested on Go1.10rc1 and Go1.9.3.
1 parent 9255415 commit bbd03ef

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

proto/extensions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
478478
t.Fatalf("[%s] Invalid extension", test.name)
479479
}
480480
if !reflect.DeepEqual(*ext, want) {
481-
t.Errorf("[%s] Wrong value for ComplexExtension: got: %s want: %s\n", test.name, ext, want)
481+
t.Errorf("[%s] Wrong value for ComplexExtension: got: %s want: %s\n", test.name, ext, &want)
482482
}
483483
}
484484
}

protoc-gen-go/generator/generator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2029,7 +2029,11 @@ func (g *Generator) generateMessage(message *Descriptor) {
20292029
// TODO: Revisit this and consider reverting back to anonymous interfaces.
20302030
for oi := range message.OneofDecl {
20312031
dname := oneofDisc[int32(oi)]
2032-
g.P("type ", dname, " interface { ", dname, "() }")
2032+
g.P("type ", dname, " interface {")
2033+
g.In()
2034+
g.P(dname, "()")
2035+
g.Out()
2036+
g.P("}")
20332037
}
20342038
g.P()
20352039
for _, field := range message.Field {

0 commit comments

Comments
 (0)