8000 Add a Comparable helper · Issue #5 · pkg/diff · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add a Comparable helper #5
Open
@mvdan

Description

@mvdan

I was just thinking that most of the types one might want to diff can already be compared for equality, as per the language spec.

So, we could add func Comparable(a, b interface{}) DiffWriteable. It would ensure that both params are of the same type, that both are slice types, and that both element types are comparable.

For example, this would be useful with integers, arrays, custom struct types, et cetera.

I'd still keep Strings, because for the foreseeable future, avoiding interface parameters will make the code faster and easier.

Potentially, we could also use the Equal method as defined in https://github.com/google/go-cmp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0