Skip to content

Panic when private fields differ #21

@dgouldin

Description

@dgouldin

Executing the following code:

package main

import (
        "fmt"
        "github.com/kr/pretty"
)

type Foo struct {
        name string
}

func main() {
        fmt.Println(pretty.Diff(Foo{name: "foo"}, Foo{name: "bar"}))
}

Panics with the message:

panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

I realize it may not be possible to actually produce the diff on private fields, but I doubt that a panic is what's intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions