nats-rpc/nrpc

Unable to build when no protobuf options declared

Closed this issue · 2 comments

Unable to build helloworld getting the following error

It looks like it only happens if no options are included in the proto file

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12887e5]

goroutine 1 [running]:
text/template.errRecover(0xc4201cfdb8)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:140 +0x1df
panic(0x12e1e20, 0x14c7900)
        /usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/golang/protobuf/protoc-gen-go/descriptor.(*FileOptions).github.com/golang/protobuf/proto.extensionsRead(0x0, 0x0, 0x14cccc0, 0x0)
        <autogenerated>:1 +0x5
github.com/golang/protobuf/proto.GetExtension(0x14b1d60, 0x0, 0x14cccc0, 0x0, 0x0, 0x0, 0x0)
        /Users/chsullivan/go/src/github.com/golang/protobuf/proto/extensions.go:367 +0x102
main.pkgSubject(0xc420120000, 0x0, 0x0)
        /Users/chsullivan/go/src/github.com/rapidloop/nrpc/protoc-gen-nrpc/main.go:221 +0x4e
reflect.Value.call(0x12d1980, 0x134aaf0, 0x13, 0x1335baa, 0x4, 0xc4201abac0, 0x1, 0x1, 0x1333c60, 0x1, ...)
        /usr/local/Cellar/go/1.9.2/libexec/src/reflect/value.go:434 +0x905
reflect.Value.Call(0x12d1980, 0x134aaf0, 0x13, 0xc4201abac0, 0x1, 0x1, 0x14b3cc0, 0xc42000d160, 0x1322ce0)
        /usr/local/Cellar/go/1.9.2/libexec/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0x12d1980, 0x134aaf0, 0x13, 0x14b3c60, 0xc420148990, 0x13457a3, ...)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:670 +0x580
text/template.(*state).evalFunction(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0xc4201489c0, 0x14b3c60, 0xc420148990, 0xc42000d180, 0x2, 0x2, ...)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:538 +0x176
text/template.(*state).evalCommand(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0xc420148990, 0x0, 0x0, 0x0, 0x12c7b40, 0xc4201aba88, ...)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:435 +0x53a
text/template.(*state).evalPipeline(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0xc420089a90, 0x12c7b40, 0xc4201aba88, 0x98)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:408 +0x115
text/template.(*state).walk(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0x14b3b40, 0xc4201489f0)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:234 +0x4af
text/template.(*state).walk(0xc4201cfd38, 0x1322ce0, 0xc420120000, 0x16, 0x14b3e40, 0xc420148780)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:242 +0x11d
text/template.(*Template).execute(0xc420122900, 0x14aea60, 0xc42021a000, 0x1322ce0, 0xc420120000, 0x0, 0x0)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:197 +0x1f9
text/template.(*Template).Execute(0xc420122900, 0x14aea60, 0xc42021a000, 0x1322ce0, 0xc420120000, 0x0, 0x0)
        /usr/local/Cellar/go/1.9.2/libexec/src/text/template/exec.go:180 +0x53
main.main()
        /Users/chsullivan/go/src/github.com/rapidloop/nrpc/protoc-gen-nrpc/main.go:440 +0x3fd
--nrpc_out: protoc-gen-nrpc: Plugin failed with status code 2.

The helloworld example has no option and compiles properly on the CI (and on my computer).
Maybe the compiler version is involved. Do you have the same error with go 1.8?

ignore my comment, I just reproduced the issue. Looking into it.