Skip to content

Panics with list of objects #2

@DBL-Lee

Description

@DBL-Lee

I was able to reproduce with following minimal code:

package main

import (
	"encoding/json"

	"github.com/herkyl/patchwerk"
)

type Foo struct {
	Name string
}

func main() {
	from, _ := json.Marshal([]Foo{
		Foo{
			Name: "a",
		},
		Foo{
			Name: "b",
		},
	})
	to, _ := json.Marshal([]Foo{
		Foo{
			Name: "c",
		},
	})
	_, err := patchwerk.Diff(
		[]byte(from),
		[]byte(to),
	)
	if err != nil {
		panic(err)
	}
}

It panics with: panic: runtime error: index out of range [1] with length 1

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