open-vault/vendor/github.com/go-test/deep
Michael Golowka bd79fbafb3
Add couchbase, elasticsearch, and mongodbatlas back (#10222)
Updated the `Serve` function so these can be added back into Vault
2020-10-22 17:20:17 -06:00
..
.gitignore Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
.travis.yml Add couchbase, elasticsearch, and mongodbatlas back (#10222) 2020-10-22 17:20:17 -06:00
CHANGES.md Add couchbase, elasticsearch, and mongodbatlas back (#10222) 2020-10-22 17:20:17 -06:00
deep.go Add couchbase, elasticsearch, and mongodbatlas back (#10222) 2020-10-22 17:20:17 -06:00
go.mod Add couchbase, elasticsearch, and mongodbatlas back (#10222) 2020-10-22 17:20:17 -06:00
go.sum Add couchbase, elasticsearch, and mongodbatlas back (#10222) 2020-10-22 17:20:17 -06:00
LICENSE Resultant acl (#4386) 2018-04-20 14:19:04 -04:00
README.md Resultant acl (#4386) 2018-04-20 14:19:04 -04:00

Deep Variable Equality for Humans

Go Report Card Build Status Coverage Status GoDoc

This package provides a single function: deep.Equal. It's like reflect.DeepEqual but much friendlier to humans (or any sentient being) for two reason:

  • deep.Equal returns a list of differences
  • deep.Equal does not compare unexported fields (by default)

reflect.DeepEqual is good (like all things Golang!), but it's a game of Hunt the Wumpus. For large maps, slices, and structs, finding the difference is difficult.

deep.Equal doesn't play games with you, it lists the differences:

package main_test

import (
	"testing"
	"github.com/go-test/deep"
)

type T struct {
	Name    string
	Numbers []float64
}

func TestDeepEqual(t *testing.T) {
	// Can you spot the difference?
	t1 := T{
		Name:    "Isabella",
		Numbers: []float64{1.13459, 2.29343, 3.010100010},
	}
	t2 := T{
		Name:    "Isabella",
		Numbers: []float64{1.13459, 2.29843, 3.010100010},
	}

	if diff := deep.Equal(t1, t2); diff != nil {
		t.Error(diff)
	}
}
$ go test
--- FAIL: TestDeepEqual (0.00s)
        main_test.go:25: [Numbers.slice[1]: 2.29343 != 2.29843]

The difference is in Numbers.slice[1]: the two values aren't equal using Go ==.