protobuf
protobuf copied to clipboard
Panic when running auto-generated tests with Go 1.13 and Go 1.14
While the auto-generated test passes cleanly with Go 1.12.2, with Go 1.13.7 or higher, it panics:
[eric@cube v3]$ go1.13.7 test
--- FAIL: TestEntityConfigProtoText (0.00s)
panic: reflect: call of reflect.Value.IsNil on struct Value [recovered]
panic: reflect: call of reflect.Value.IsNil on struct Value
goroutine 10 [running]:
testing.tRunner.func1(0xc0003f1400)
/home/eric/sdk/go1.13.7/src/testing/testing.go:874 +0x3a3
panic(0xca4b80, 0xc000494820)
/home/eric/sdk/go1.13.7/src/runtime/panic.go:679 +0x1b2
reflect.Value.IsNil(...)
/home/eric/sdk/go1.13.7/src/reflect/value.go:1073
google.golang.org/protobuf/internal/impl.fieldInfoForMessage.func1(0xc0000d8340, 0xeed240)
/home/eric/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect_field.go:391 +0x164
google.golang.org/protobuf/internal/impl.(*messageReflectWrapper).Has(0xc00020c9b0, 0xeed240, 0xc0000eb560, 0xc0000eb560)
/home/eric/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect_gen.go:187 +0x82
github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc0004be090, 0xee7620, 0xc00020c9b0, 0x0, 0x0)
/home/eric/go/pkg/mod/github.com/golang/[email protected]/proto/text_encode.go:278 +0x925
github.com/golang/protobuf/proto.(*TextMarshaler).marshal(0x1503754, 0xed8aa0, 0xc0000d8340, 0xc0000d8340, 0xc000162a00, 0x501601, 0xc0000d8270, 0x501b3d)
/home/eric/go/pkg/mod/github.com/golang/[email protected]/proto/text_encode.go:86 +0x18a
github.com/golang/protobuf/proto.(*TextMarshaler).Text(...)
/home/eric/go/pkg/mod/github.com/golang/[email protected]/proto/text_encode.go:44
github.com/golang/protobuf/proto.MarshalTextString(...)
/home/eric/go/pkg/mod/github.com/golang/[email protected]/proto/text_encode.go:100
github.com/sensu/sensu-go/api/core/v3.TestEntityConfigProtoText(0xc0003f1400)
/home/eric/go/src/github.com/sensu/sensu-go/api/core/v3/entity_configpb_test.go:102 +0x1a1
testing.tRunner(0xc0003f1400, 0xdebad8)
/home/eric/sdk/go1.13.7/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
/home/eric/sdk/go1.13.7/src/testing/testing.go:960 +0x350
exit status 2
FAIL github.com/sensu/sensu-go/api/core/v3 0.015s
[eric@cube v3]$ go1.12.2 test
PASS
ok github.com/sensu/sensu-go/api/core/v3 0.008s
[eric@cube v3]$
The protobuf that causes this test to be generated can be found here: https://github.com/sensu/sensu-go/blob/master/api/core/v3/entity_config.proto
libprotoc 3.9.1
github.com/gogo/[email protected]