Fresh dep ensure

This commit is contained in:
Mike Cronce
2018-11-26 13:23:56 -05:00
parent 93cb8a04d7
commit 407478ab9a
9016 changed files with 551394 additions and 279685 deletions

View File

@ -1,39 +0,0 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = ["util_test.go"],
embed = [":go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"errors.go",
"util.go",
],
importpath = "k8s.io/apimachinery/pkg/util/mergepatch",
deps = [
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -21,7 +21,7 @@ import (
"reflect"
"github.com/davecgh/go-spew/spew"
"github.com/ghodss/yaml"
"sigs.k8s.io/yaml"
)
// PreconditionFunc asserts that an incompatible change is not present within a patch.
@ -125,7 +125,7 @@ func HasConflicts(left, right interface{}) (bool, error) {
default:
return true, nil
}
case string, float64, bool, int, int64, nil:
case string, float64, bool, int64, nil:
return !reflect.DeepEqual(left, right), nil
default:
return true, fmt.Errorf("unknown type: %v", reflect.TypeOf(left))

View File

@ -30,82 +30,80 @@ func TestHasConflicts(t *testing.T) {
{A: "hello", B: "hello", Ret: false},
{A: "hello", B: "hell", Ret: true},
{A: "hello", B: nil, Ret: true},
{A: "hello", B: 1, Ret: true},
{A: "hello", B: int64(1), Ret: true},
{A: "hello", B: float64(1.0), Ret: true},
{A: "hello", B: false, Ret: true},
{A: 1, B: 1, Ret: false},
{A: int64(1), B: int64(1), Ret: false},
{A: nil, B: nil, Ret: false},
{A: false, B: false, Ret: false},
{A: float64(3), B: float64(3), Ret: false},
{A: "hello", B: []interface{}{}, Ret: true},
{A: []interface{}{1}, B: []interface{}{}, Ret: true},
{A: []interface{}{int64(1)}, B: []interface{}{}, Ret: true},
{A: []interface{}{}, B: []interface{}{}, Ret: false},
{A: []interface{}{1}, B: []interface{}{1}, Ret: false},
{A: map[string]interface{}{}, B: []interface{}{1}, Ret: true},
{A: []interface{}{int64(1)}, B: []interface{}{int64(1)}, Ret: false},
{A: map[string]interface{}{}, B: []interface{}{int64(1)}, Ret: true},
{A: map[string]interface{}{}, B: map[string]interface{}{"a": 1}, Ret: false},
{A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"a": 1}, Ret: false},
{A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"a": 2}, Ret: true},
{A: map[string]interface{}{"a": 1}, B: map[string]interface{}{"b": 2}, Ret: false},
{A: map[string]interface{}{}, B: map[string]interface{}{"a": int64(1)}, Ret: false},
{A: map[string]interface{}{"a": int64(1)}, B: map[string]interface{}{"a": int64(1)}, Ret: false},
{A: map[string]interface{}{"a": int64(1)}, B: map[string]interface{}{"a": int64(2)}, Ret: true},
{A: map[string]interface{}{"a": int64(1)}, B: map[string]interface{}{"b": int64(2)}, Ret: false},
{
A: map[string]interface{}{"a": []interface{}{1}},
B: map[string]interface{}{"a": []interface{}{1}},
A: map[string]interface{}{"a": []interface{}{int64(1)}},
B: map[string]interface{}{"a": []interface{}{int64(1)}},
Ret: false,
},
{
A: map[string]interface{}{"a": []interface{}{1}},
A: map[string]interface{}{"a": []interface{}{int64(1)}},
B: map[string]interface{}{"a": []interface{}{}},
Ret: true,
},
{
A: map[string]interface{}{"a": []interface{}{1}},
B: map[string]interface{}{"a": 1},
A: map[string]interface{}{"a": []interface{}{int64(1)}},
B: map[string]interface{}{"a": int64(1)},
Ret: true,
},
// Maps and lists with multiple entries.
{
A: map[string]interface{}{"a": 1, "b": 2},
B: map[string]interface{}{"a": 1, "b": 0},
A: map[string]interface{}{"a": int64(1), "b": int64(2)},
B: map[string]interface{}{"a": int64(1), "b": int64(0)},
Ret: true,
},
{
A: map[string]interface{}{"a": 1, "b": 2},
B: map[string]interface{}{"a": 1, "b": 2},
A: map[string]interface{}{"a": int64(1), "b": int64(2)},
B: map[string]interface{}{"a": int64(1), "b": int64(2)},
Ret: false,
},
{
A: map[string]interface{}{"a": 1, "b": 2},
B: map[string]interface{}{"a": 1, "b": 0, "c": 3},
A: map[string]interface{}{"a": int64(1), "b": int64(2)},
B: map[string]interface{}{"a": int64(1), "b": int64(0), "c": int64(3)},
Ret: true,
},
{
A: map[string]interface{}{"a": 1, "b": 2},
B: map[string]interface{}{"a": 1, "b": 2, "c": 3},
A: map[string]interface{}{"a": int64(1), "b": int64(2)},
B: map[string]interface{}{"a": int64(1), "b": int64(2), "c": int64(3)},
Ret: false,
},
{
A: map[string]interface{}{"a": []interface{}{1, 2}},
B: map[string]interface{}{"a": []interface{}{1, 0}},
A: map[string]interface{}{"a": []interface{}{int64(1), int64(2)}},
B: map[string]interface{}{"a": []interface{}{int64(1), int64(0)}},
Ret: true,
},
{
A: map[string]interface{}{"a": []interface{}{1, 2}},
B: map[string]interface{}{"a": []interface{}{1, 2}},
A: map[string]interface{}{"a": []interface{}{int64(1), int64(2)}},
B: map[string]interface{}{"a": []interface{}{int64(1), int64(2)}},
Ret: false,
},
// Numeric types are not interchangeable.
// Callers are expected to ensure numeric types are consistent in 'left' and 'right'.
{A: int(0), B: int64(0), Ret: true},
{A: int(0), B: float64(0), Ret: true},
{A: int64(0), B: float64(0), Ret: true},
// Other types are not interchangeable.
{A: int(0), B: "0", Ret: true},
{A: int(0), B: nil, Ret: true},
{A: int(0), B: false, Ret: true},
{A: int64(0), B: "0", Ret: true},
{A: int64(0), B: nil, Ret: true},
{A: int64(0), B: false, Ret: true},
{A: "true", B: true, Ret: true},
{A: "null", B: nil, Ret: true},
}