Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when struct has a time.Time field #4

Closed
glebtv opened this issue Jan 11, 2019 · 3 comments
Closed

Panic when struct has a time.Time field #4

glebtv opened this issue Jan 11, 2019 · 3 comments

Comments

@glebtv
Copy link
Contributor

glebtv commented Jan 11, 2019

reproduction:

package main

import (
	"log"
	"time"

	"github.com/r3labs/diff"
)

type Order struct {
	ID   string    `diff:"id"`
	Time time.Time `diff:"time"`
}

func main() {
	a := Order{
		ID:   "1234",
		Time: time.Now(),
	}

	b := Order{
		ID:   "1234",
		Time: time.Now(),
	}

	changelog, err := diff.Diff(a, b)
	log.Println(changelog, err)
}

Expected result: something returned
Actual result: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

go version go1.11.4 linux/amd64

@purehyperbole
Copy link
Member

Sorry for the delay, I've added time.Time to the supported list of types. Could you please test with the time-diff branch and confirm if it fixes your issue?

@glebtv
Copy link
Contributor Author

glebtv commented Jan 17, 2019

It works with time-diff branch, thank you!

@purehyperbole
Copy link
Member

awesome, thanks for testing. I'll merge that into master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants