Package list golang-github-imdario-mergo / 23d4eb2
Remove partial patch accidentally committed to master Tim Potter 5 years ago
8 changed file(s) with 28 addition(s) and 181 deletion(s). Raw diff Collapse all Expand all
0 golang-github-imdario-mergo (0.2.2-1) UNRELEASED; urgency=medium
1
2 * New upstream version
3
4 -- Tim Potter <tpot@hpe.com> Fri, 15 Apr 2016 09:37:02 +1000
5
06 golang-github-imdario-mergo (0.2.0-1) unstable; urgency=medium
17
28 * Initial release (Closes: #802743)
22 Priority: extra
33 Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org>
44 Uploaders: Tim Potter <tpot@hpe.com>
5 Build-Depends: debhelper (>= 9),
6 dh-golang,
7 golang-go
5 Build-Depends: debhelper (>= 9), dh-golang, golang-go, golang-yaml.v2-dev
86 Standards-Version: 3.9.7
97 Homepage: https://github.com/imdario/mergo
108 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-go/packages/golang-github-imdario-mergo.git
1311
1412 Package: golang-github-imdario-mergo-dev
1513 Architecture: all
16 Depends: ${shlibs:Depends},
17 ${misc:Depends},
18 golang-go
14 Depends: golang-go, golang-yaml.v2-dev, ${misc:Depends}, ${shlibs:Depends}
1915 Description: Functions to merge structs and maps in Go
2016 Mergo is a set of helper functions to merge structs and maps in
2117 the Go language. It is useful for configuration default values,
+0
-148
debian/patches/0001-disable-yaml-tests.patch less more
0 Index: golang-github-imdario-mergo/mergo_test.go
1 ===================================================================
2 --- golang-github-imdario-mergo.orig/mergo_test.go
3 +++ golang-github-imdario-mergo/mergo_test.go
4 @@ -6,11 +6,8 @@
5 package mergo
6
7 import (
8 - "io/ioutil"
9 "reflect"
10 "testing"
11 -
12 - "gopkg.in/yaml.v1"
13 )
14
15 type simpleTest struct {
16 @@ -311,131 +308,3 @@ func TestMaps(t *testing.T) {
17 t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value)
18 }
19 }
20 -
21 -func TestYAMLMaps(t *testing.T) {
22 - thing := loadYAML("testdata/thing.yml")
23 - license := loadYAML("testdata/license.yml")
24 - ft := thing["fields"].(map[interface{}]interface{})
25 - fl := license["fields"].(map[interface{}]interface{})
26 - expectedLength := len(ft) + len(fl)
27 - if err := Merge(&license, thing); err != nil {
28 - t.Fatal(err.Error())
29 - }
30 - currentLength := len(license["fields"].(map[interface{}]interface{}))
31 - if currentLength != expectedLength {
32 - t.Fatalf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength)
33 - }
34 - fields := license["fields"].(map[interface{}]interface{})
35 - if _, ok := fields["id"]; !ok {
36 - t.Fatalf(`thing not merged in license properly, license must have a new id field from thing`)
37 - }
38 -}
39 -
40 -func TestTwoPointerValues(t *testing.T) {
41 - a := &simpleTest{}
42 - b := &simpleTest{42}
43 - if err := Merge(a, b); err != nil {
44 - t.Fatalf(`Boom. You crossed the streams: %s`, err)
45 - }
46 -}
47 -
48 -func TestMap(t *testing.T) {
49 - a := complexTest{}
50 - a.Id = "athing"
51 - c := moreComplextText{a, simpleTest{}, simpleTest{}}
52 - b := map[string]interface{}{
53 - "ct": map[string]interface{}{
54 - "st": map[string]interface{}{
55 - "value": 42,
56 - },
57 - "sz": 1,
58 - "id": "bthing",
59 - },
60 - "st": &simpleTest{144}, // Mapping a reference
61 - "zt": simpleTest{299}, // Mapping a missing field (zt doesn't exist)
62 - "nt": simpleTest{3},
63 - }
64 - if err := Map(&c, b); err != nil {
65 - t.FailNow()
66 - }
67 - m := b["ct"].(map[string]interface{})
68 - n := m["st"].(map[string]interface{})
69 - o := b["st"].(*simpleTest)
70 - p := b["nt"].(simpleTest)
71 - if c.Ct.St.Value != 42 {
72 - t.Fatalf("b not merged in properly: c.Ct.St.Value(%d) != b.Ct.St.Value(%d)", c.Ct.St.Value, n["value"])
73 - }
74 - if c.St.Value != 144 {
75 - t.Fatalf("b not merged in properly: c.St.Value(%d) != b.St.Value(%d)", c.St.Value, o.Value)
76 - }
77 - if c.Nt.Value != 3 {
78 - t.Fatalf("b not merged in properly: c.Nt.Value(%d) != b.Nt.Value(%d)", c.St.Value, p.Value)
79 - }
80 - if c.Ct.sz == 1 {
81 - t.Fatalf("a's private field sz not preserved from merge: c.Ct.sz(%d) == b.Ct.sz(%d)", c.Ct.sz, m["sz"])
82 - }
83 - if c.Ct.Id == m["id"] {
84 - t.Fatalf("a's field Id merged unexpectedly: c.Ct.Id(%s) == b.Ct.Id(%s)", c.Ct.Id, m["id"])
85 - }
86 -}
87 -
88 -func TestSimpleMap(t *testing.T) {
89 - a := simpleTest{}
90 - b := map[string]interface{}{
91 - "value": 42,
92 - }
93 - if err := Map(&a, b); err != nil {
94 - t.FailNow()
95 - }
96 - if a.Value != 42 {
97 - t.Fatalf("b not merged in properly: a.Value(%d) != b.Value(%v)", a.Value, b["value"])
98 - }
99 -}
100 -
101 -type pointerMapTest struct {
102 - A int
103 - hidden int
104 - B *simpleTest
105 -}
106 -
107 -func TestBackAndForth(t *testing.T) {
108 - pt := pointerMapTest{42, 1, &simpleTest{66}}
109 - m := make(map[string]interface{})
110 - if err := Map(&m, pt); err != nil {
111 - t.FailNow()
112 - }
113 - var (
114 - v interface{}
115 - ok bool
116 - )
117 - if v, ok = m["a"]; v.(int) != pt.A || !ok {
118 - t.Fatalf("pt not merged in properly: m[`a`](%d) != pt.A(%d)", v, pt.A)
119 - }
120 - if v, ok = m["b"]; !ok {
121 - t.Fatalf("pt not merged in properly: B is missing in m")
122 - }
123 - var st *simpleTest
124 - if st = v.(*simpleTest); st.Value != 66 {
125 - t.Fatalf("something went wrong while mapping pt on m, B wasn't copied")
126 - }
127 - bpt := pointerMapTest{}
128 - if err := Map(&bpt, m); err != nil {
129 - t.Fatal(err)
130 - }
131 - if bpt.A != pt.A {
132 - t.Fatalf("pt not merged in properly: bpt.A(%d) != pt.A(%d)", bpt.A, pt.A)
133 - }
134 - if bpt.hidden == pt.hidden {
135 - t.Fatalf("pt unexpectedly merged: bpt.hidden(%d) == pt.hidden(%d)", bpt.hidden, pt.hidden)
136 - }
137 - if bpt.B.Value != pt.B.Value {
138 - t.Fatalf("pt not merged in properly: bpt.B.Value(%d) != pt.B.Value(%d)", bpt.B.Value, pt.B.Value)
139 - }
140 -}
141 -
142 -func loadYAML(path string) (m map[string]interface{}) {
143 - m = make(map[string]interface{})
144 - raw, _ := ioutil.ReadFile(path)
145 - _ = yaml.Unmarshal(raw, &m)
146 - return
147 -}
+0
-21
debian/patches/0001-rename-yaml-v1.patch less more
0 Index: golang-github-imdario-mergo/mergo_test.go
1 ===================================================================
2 --- golang-github-imdario-mergo.orig/mergo_test.go
3 +++ golang-github-imdario-mergo/mergo_test.go
4 @@ -10,7 +10,7 @@ import (
5 "reflect"
6 "testing"
7
8 - "gopkg.in/yaml.v1"
9 + "launchpad.net/goyaml"
10 )
11
12 type simpleTest struct {
13 @@ -436,6 +436,6 @@ func TestBackAndForth(t *testing.T) {
14 func loadYAML(path string) (m map[string]interface{}) {
15 m = make(map[string]interface{})
16 raw, _ := ioutil.ReadFile(path)
17 - _ = yaml.Unmarshal(raw, &m)
18 + _ = goyaml.Unmarshal(raw, &m)
19 return
20 }
11 ===================================================================
22 --- golang-github-imdario-mergo.orig/mergo_test.go
33 +++ golang-github-imdario-mergo/mergo_test.go
4 @@ -10,7 +10,7 @@ import (
5 "reflect"
4 @@ -11,7 +11,7 @@ import (
65 "testing"
6 "time"
77
88 - "gopkg.in/yaml.v1"
99 + "gopkg.in/yaml.v2"
0 Index: golang-github-imdario-mergo/mergo_test.go
1 ===================================================================
2 --- golang-github-imdario-mergo.orig/mergo_test.go
3 +++ golang-github-imdario-mergo/mergo_test.go
4 @@ -314,8 +314,8 @@ func TestMaps(t *testing.T) {
5 }
6
7 func TestYAMLMaps(t *testing.T) {
8 - thing := loadYAML("testdata/thing.yml")
9 - license := loadYAML("testdata/license.yml")
10 + thing := loadYAML("../../../../../testdata/thing.yml")
11 + license := loadYAML("../../../../../testdata/license.yml")
12 ft := thing["fields"].(map[interface{}]interface{})
13 fl := license["fields"].(map[interface{}]interface{})
14 expectedLength := len(ft) + len(fl)
0 0001-disable-yaml-tests.patch
0 0001-use-newer-yaml-library.patch
1 0002-fix-test-fixture-locations.patch
55 package mergo
66
77 import (
8 "io/ioutil"
89 "reflect"
910 "testing"
1011 "time"
310311 t.Fatalf(`n overwritten in m: m["c"].Value(%d) != n["c"].Value(%d)`, m["c"].Value, n["c"].Value)
311312 }
312313 }
313 <<<<<<< HEAD
314 =======
315314
316315 func TestYAMLMaps(t *testing.T) {
317316 thing := loadYAML("testdata/thing.yml")
523522 }()
524523 Merge(&a, b)
525524 }
526 >>>>>>> upstream/0.2.2