src-d / proteus

Generate .proto files from Go source code.
https://blog.sourced.tech/post/proteus/
MIT License
735 stars 70 forks source link

Issue with time.Duration #68

Closed alban closed 7 years ago

alban commented 7 years ago

This works fine:

package mytest

type MyDuration int64

//proteus:generate
type MyType struct {
        Sleeping MyDuration
}
$ proteus -p github.com/alban/mytest -f . ; echo $?
0

But this does not work:

package mytest

import (
        "time"
)

//proteus:generate
type MyType struct {
        Sleeping time.Duration
}
$ proteus -p github.com/alban/mytest -f . ; echo $?
generated.proto: warning: Import google/protobuf/duration.proto but not used.
ERROR: field MyType.Sleeping is a native type and in proto3 syntax with nullable=false there exists conflicting implementations when encoding zero values--gofast_out: protoc-gen-gofast: Plugin failed with status code 1.
error generating Go files from "github.com/alban/mytest/generated.proto": exit status 1
1

I don't understand what that means. time.Duration is basically a int64, so what's the difference between the two code snippets?

/cc @asymmetric

Serabe commented 7 years ago

@alban I just made a new release with a few fixes. Thank you for the report!

alban commented 7 years ago

@Serabe thanks!