diff --git a/debian/changelog b/debian/changelog index 5a045a9..d484ce5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +golang-github-imdario-mergo (0.2.2-1) UNRELEASED; urgency=medium + + * New upstream version + + -- Tim Potter Fri, 15 Apr 2016 09:37:02 +1000 + golang-github-imdario-mergo (0.2.0-1) unstable; urgency=medium * Initial release (Closes: #802743) diff --git a/debian/control b/debian/control index 9dfb54a..fc2b411 100644 --- a/debian/control +++ b/debian/control @@ -3,9 +3,7 @@ Priority: extra Maintainer: Debian Go Packaging Team Uploaders: Tim Potter -Build-Depends: debhelper (>= 9), - dh-golang, - golang-go +Build-Depends: debhelper (>= 9), dh-golang, golang-go, golang-yaml.v2-dev Standards-Version: 3.9.7 Homepage: https://github.com/imdario/mergo Vcs-Browser: https://anonscm.debian.org/cgit/pkg-go/packages/golang-github-imdario-mergo.git @@ -14,9 +12,7 @@ Package: golang-github-imdario-mergo-dev Architecture: all -Depends: ${shlibs:Depends}, - ${misc:Depends}, - golang-go +Depends: golang-go, golang-yaml.v2-dev, ${misc:Depends}, ${shlibs:Depends} Description: Functions to merge structs and maps in Go Mergo is a set of helper functions to merge structs and maps in the Go language. It is useful for configuration default values, diff --git a/debian/patches/0001-disable-yaml-tests.patch b/debian/patches/0001-disable-yaml-tests.patch deleted file mode 100644 index ba3867a..0000000 --- a/debian/patches/0001-disable-yaml-tests.patch +++ /dev/null @@ -1,148 +0,0 @@ -Index: golang-github-imdario-mergo/mergo_test.go -=================================================================== ---- golang-github-imdario-mergo.orig/mergo_test.go -+++ golang-github-imdario-mergo/mergo_test.go -@@ -6,11 +6,8 @@ - package mergo - - import ( -- "io/ioutil" - "reflect" - "testing" -- -- "gopkg.in/yaml.v1" - ) - - type simpleTest struct { -@@ -311,131 +308,3 @@ func TestMaps(t *testing.T) { - t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value) - } - } -- --func TestYAMLMaps(t *testing.T) { -- thing := loadYAML("testdata/thing.yml") -- license := loadYAML("testdata/license.yml") -- ft := thing["fields"].(map[interface{}]interface{}) -- fl := license["fields"].(map[interface{}]interface{}) -- expectedLength := len(ft) + len(fl) -- if err := Merge(&license, thing); err != nil { -- t.Fatal(err.Error()) -- } -- currentLength := len(license["fields"].(map[interface{}]interface{})) -- if currentLength != expectedLength { -- t.Fatalf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength) -- } -- fields := license["fields"].(map[interface{}]interface{}) -- if _, ok := fields["id"]; !ok { -- t.Fatalf(`thing not merged in license properly, license must have a new id field from thing`) -- } --} -- --func TestTwoPointerValues(t *testing.T) { -- a := &simpleTest{} -- b := &simpleTest{42} -- if err := Merge(a, b); err != nil { -- t.Fatalf(`Boom. You crossed the streams: %s`, err) -- } --} -- --func TestMap(t *testing.T) { -- a := complexTest{} -- a.Id = "athing" -- c := moreComplextText{a, simpleTest{}, simpleTest{}} -- b := map[string]interface{}{ -- "ct": map[string]interface{}{ -- "st": map[string]interface{}{ -- "value": 42, -- }, -- "sz": 1, -- "id": "bthing", -- }, -- "st": &simpleTest{144}, // Mapping a reference -- "zt": simpleTest{299}, // Mapping a missing field (zt doesn't exist) -- "nt": simpleTest{3}, -- } -- if err := Map(&c, b); err != nil { -- t.FailNow() -- } -- m := b["ct"].(map[string]interface{}) -- n := m["st"].(map[string]interface{}) -- o := b["st"].(*simpleTest) -- p := b["nt"].(simpleTest) -- if c.Ct.St.Value != 42 { -- t.Fatalf("b not merged in properly: c.Ct.St.Value(%d) != b.Ct.St.Value(%d)", c.Ct.St.Value, n["value"]) -- } -- if c.St.Value != 144 { -- t.Fatalf("b not merged in properly: c.St.Value(%d) != b.St.Value(%d)", c.St.Value, o.Value) -- } -- if c.Nt.Value != 3 { -- t.Fatalf("b not merged in properly: c.Nt.Value(%d) != b.Nt.Value(%d)", c.St.Value, p.Value) -- } -- if c.Ct.sz == 1 { -- t.Fatalf("a's private field sz not preserved from merge: c.Ct.sz(%d) == b.Ct.sz(%d)", c.Ct.sz, m["sz"]) -- } -- if c.Ct.Id == m["id"] { -- t.Fatalf("a's field Id merged unexpectedly: c.Ct.Id(%s) == b.Ct.Id(%s)", c.Ct.Id, m["id"]) -- } --} -- --func TestSimpleMap(t *testing.T) { -- a := simpleTest{} -- b := map[string]interface{}{ -- "value": 42, -- } -- if err := Map(&a, b); err != nil { -- t.FailNow() -- } -- if a.Value != 42 { -- t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%v)", a.Value, b["value"]) -- } --} -- --type pointerMapTest struct { -- A int -- hidden int -- B *simpleTest --} -- --func TestBackAndForth(t *testing.T) { -- pt := pointerMapTest{42, 1, &simpleTest{66}} -- m := make(map[string]interface{}) -- if err := Map(&m, pt); err != nil { -- t.FailNow() -- } -- var ( -- v interface{} -- ok bool -- ) -- if v, ok = m["a"]; v.(int) != pt.A || !ok { -- t.Fatalf("pt not merged in properly: m[`a`](%d) != pt.A(%d)", v, pt.A) -- } -- if v, ok = m["b"]; !ok { -- t.Fatalf("pt not merged in properly: B is missing in m") -- } -- var st *simpleTest -- if st = v.(*simpleTest); st.Value != 66 { -- t.Fatalf("something went wrong while mapping pt on m, B wasn't copied") -- } -- bpt := pointerMapTest{} -- if err := Map(&bpt, m); err != nil { -- t.Fatal(err) -- } -- if bpt.A != pt.A { -- t.Fatalf("pt not merged in properly: bpt.A(%d) != pt.A(%d)", bpt.A, pt.A) -- } -- if bpt.hidden == pt.hidden { -- t.Fatalf("pt unexpectedly merged: bpt.hidden(%d) == pt.hidden(%d)", bpt.hidden, pt.hidden) -- } -- if bpt.B.Value != pt.B.Value { -- t.Fatalf("pt not merged in properly: bpt.B.Value(%d) != pt.B.Value(%d)", bpt.B.Value, pt.B.Value) -- } --} -- --func loadYAML(path string) (m map[string]interface{}) { -- m = make(map[string]interface{}) -- raw, _ := ioutil.ReadFile(path) -- _ = yaml.Unmarshal(raw, &m) -- return --} diff --git a/debian/patches/0001-rename-yaml-v1.patch b/debian/patches/0001-rename-yaml-v1.patch deleted file mode 100644 index fe4d371..0000000 --- a/debian/patches/0001-rename-yaml-v1.patch +++ /dev/null @@ -1,21 +0,0 @@ -Index: golang-github-imdario-mergo/mergo_test.go -=================================================================== ---- golang-github-imdario-mergo.orig/mergo_test.go -+++ golang-github-imdario-mergo/mergo_test.go -@@ -10,7 +10,7 @@ import ( - "reflect" - "testing" - -- "gopkg.in/yaml.v1" -+ "launchpad.net/goyaml" - ) - - type simpleTest struct { -@@ -436,6 +436,6 @@ func TestBackAndForth(t *testing.T) { - func loadYAML(path string) (m map[string]interface{}) { - m = make(map[string]interface{}) - raw, _ := ioutil.ReadFile(path) -- _ = yaml.Unmarshal(raw, &m) -+ _ = goyaml.Unmarshal(raw, &m) - return - } diff --git a/debian/patches/0001-use-newer-yaml-library.patch b/debian/patches/0001-use-newer-yaml-library.patch index 0815a05..fb1b990 100644 --- a/debian/patches/0001-use-newer-yaml-library.patch +++ b/debian/patches/0001-use-newer-yaml-library.patch @@ -2,9 +2,9 @@ =================================================================== --- golang-github-imdario-mergo.orig/mergo_test.go +++ golang-github-imdario-mergo/mergo_test.go -@@ -10,7 +10,7 @@ import ( - "reflect" +@@ -11,7 +11,7 @@ import ( "testing" + "time" - "gopkg.in/yaml.v1" + "gopkg.in/yaml.v2" diff --git a/debian/patches/0002-fix-test-fixture-locations.patch b/debian/patches/0002-fix-test-fixture-locations.patch new file mode 100644 index 0000000..2860f0b --- /dev/null +++ b/debian/patches/0002-fix-test-fixture-locations.patch @@ -0,0 +1,15 @@ +Index: golang-github-imdario-mergo/mergo_test.go +=================================================================== +--- golang-github-imdario-mergo.orig/mergo_test.go ++++ golang-github-imdario-mergo/mergo_test.go +@@ -314,8 +314,8 @@ func TestMaps(t *testing.T) { + } + + func TestYAMLMaps(t *testing.T) { +- thing := loadYAML("testdata/thing.yml") +- license := loadYAML("testdata/license.yml") ++ thing := loadYAML("../../../../../testdata/thing.yml") ++ license := loadYAML("../../../../../testdata/license.yml") + ft := thing["fields"].(map[interface{}]interface{}) + fl := license["fields"].(map[interface{}]interface{}) + expectedLength := len(ft) + len(fl) diff --git a/debian/patches/series b/debian/patches/series index dbe51cb..4a5a7c3 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ -0001-disable-yaml-tests.patch +0001-use-newer-yaml-library.patch +0002-fix-test-fixture-locations.patch diff --git a/mergo_test.go b/mergo_test.go index 362c54d..dd2651b 100644 --- a/mergo_test.go +++ b/mergo_test.go @@ -6,6 +6,7 @@ package mergo import ( + "io/ioutil" "reflect" "testing" "time" @@ -311,8 +312,6 @@ t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value) } } -<<<<<<< HEAD -======= func TestYAMLMaps(t *testing.T) { thing := loadYAML("testdata/thing.yml") @@ -524,4 +523,3 @@ }() Merge(&a, b) } ->>>>>>> upstream/0.2.2