Closed shuqingzai closed 1 year ago
Goverter doesn't know how to deeply clone carbon.DateTime
so, you've to manually define the method. As far as I can see, carbon.DateTime is immutable and every call method call on it will return a new instance. Due to this, you can just pass the object through without doing any deep cloning, because you don't have to clone a value that is immutable.
// goverter:converter
// goverter:extend CloneDateTime
type Converter interface {
Convert(*In) *Out
}
type In struct {
CreatedAt carbon.DateTime
ReleasedAt *carbon.DateTime
}
type Out struct {
CreatedAt carbon.DateTime
ReleasedAt *carbon.DateTime
}
func CloneDateTime(source carbon.DateTime) carbon.DateTime {
return source
}
Thanks
Describe the bug A clear and concise description of what the bug is.
To Reproduce Include the input file that goverter has problems with, and describe the steps you took to trigger the bug
Expected behavior A clear and concise description of what you expected to happen.
time.go
If the unexported field is ignored, panic: runtime error: invalid memory address or nil pointer dereference
If unexported fields are not ignored, an error field mismatch will be reported