Skip to content

Commit cde9f0e

Browse files
authored
Merge pull request #246 from darccio/darccio/v1-frozen
chore: frozen v1
2 parents 7f7b4af + f1e2fe5 commit cde9f0e

File tree

1 file changed

+56
-46
lines changed

1 file changed

+56
-46
lines changed

README.md

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,21 @@ Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the
4444

4545
## Status
4646

47-
It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, Microsoft, etc](https://github.com/imdario/mergo#mergo-in-the-wild).
47+
Mergo is stable and frozen, ready for production. Check a short list of the projects using at large scale it [here](https://github.com/imdario/mergo#mergo-in-the-wild).
48+
49+
No new features are accepted. They will be considered for a future v2 that improves the implementation and fixes bugs for corner cases.
4850

4951
### Important notes
5052

5153
#### 1.0.0
5254

53-
In [1.0.0](//github.com/imdario/mergo/releases/tag/1.0.0) Mergo moves to a vanity URL `dario.cat/mergo`.
55+
In [1.0.0](//github.com/imdario/mergo/releases/tag/1.0.0) Mergo moves to a vanity URL `dario.cat/mergo`. No more v1 versions will be released.
56+
57+
If the vanity URL is causing issues in your project due to a dependency pulling Mergo - it isn't a direct dependency in your project - it is recommended to use [replace](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive) to pin the version to the last one with the old import URL:
58+
59+
```
60+
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
61+
```
5462

5563
#### 0.3.9
5664

@@ -64,55 +72,24 @@ If you were using Mergo before April 6th, 2015, please check your project works
6472

6573
If Mergo is useful to you, consider buying me a coffee, a beer, or making a monthly donation to allow me to keep building great free software. :heart_eyes:
6674

67-
<a href='https://ko-fi.com/B0B58839' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
6875
<a href="https://liberapay.com/dario/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
6976
<a href='https://github.com/sponsors/imdario' target='_blank'><img alt="Become my sponsor" src="https://img.shields.io/github/sponsors/imdario?style=for-the-badge" /></a>
7077

7178
### Mergo in the wild
7279

73-
- [moby/moby](https://github.com/moby/moby)
74-
- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)
75-
- [vmware/dispatch](https://github.com/vmware/dispatch)
76-
- [Shopify/themekit](https://github.com/Shopify/themekit)
77-
- [imdario/zas](https://github.com/imdario/zas)
78-
- [matcornic/hermes](https://github.com/matcornic/hermes)
79-
- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go)
80-
- [kataras/iris](https://github.com/kataras/iris)
81-
- [michaelsauter/crane](https://github.com/michaelsauter/crane)
82-
- [go-task/task](https://github.com/go-task/task)
83-
- [sensu/uchiwa](https://github.com/sensu/uchiwa)
84-
- [ory/hydra](https://github.com/ory/hydra)
85-
- [sisatech/vcli](https://github.com/sisatech/vcli)
86-
- [dairycart/dairycart](https://github.com/dairycart/dairycart)
87-
- [projectcalico/felix](https://github.com/projectcalico/felix)
88-
- [resin-os/balena](https://github.com/resin-os/balena)
89-
- [go-kivik/kivik](https://github.com/go-kivik/kivik)
90-
- [Telefonica/govice](https://github.com/Telefonica/govice)
91-
- [supergiant/supergiant](supergiant/supergiant)
92-
- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce)
93-
- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy)
94-
- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel)
95-
- [EagerIO/Stout](https://github.com/EagerIO/Stout)
96-
- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api)
97-
- [russross/canvasassignments](https://github.com/russross/canvasassignments)
98-
- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api)
99-
- [casualjim/exeggutor](https://github.com/casualjim/exeggutor)
100-
- [divshot/gitling](https://github.com/divshot/gitling)
101-
- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl)
102-
- [andrerocker/deploy42](https://github.com/andrerocker/deploy42)
103-
- [elwinar/rambler](https://github.com/elwinar/rambler)
104-
- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman)
105-
- [jfbus/impressionist](https://github.com/jfbus/impressionist)
106-
- [Jmeyering/zealot](https://github.com/Jmeyering/zealot)
107-
- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host)
108-
- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go)
109-
- [thoas/picfit](https://github.com/thoas/picfit)
110-
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
111-
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
112-
- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
113-
- [containerssh/containerssh](https://github.com/containerssh/containerssh)
114-
- [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser)
115-
- [tjpnz/structbot](https://github.com/tjpnz/structbot)
80+
Mergo is used by [thousands](https://deps.dev/go/dario.cat%2Fmergo/v1.0.0/dependents) [of](https://deps.dev/go/github.com%2Fimdario%2Fmergo/v0.3.16/dependents) [projects](https://deps.dev/go/github.com%2Fimdario%2Fmergo/v0.3.12), including:
81+
82+
* [containerd/containerd](https://github.com/containerd/containerd)
83+
* [datadog/datadog-agent](https://github.com/datadog/datadog-agent)
84+
* [docker/cli/](https://github.com/docker/cli/)
85+
* [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser)
86+
* [go-micro/go-micro](https://github.com/go-micro/go-micro)
87+
* [grafana/loki](https://github.com/grafana/loki)
88+
* [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)
89+
* [masterminds/sprig](github.com/Masterminds/sprig)
90+
* [moby/moby](https://github.com/moby/moby)
91+
* [slackhq/nebula](https://github.com/slackhq/nebula)
92+
* [volcano-sh/volcano](https://github.com/volcano-sh/volcano)
11693

11794
## Install
11895

@@ -141,6 +118,39 @@ if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil {
141118
}
142119
```
143120

121+
If you need to override pointers, so the source pointer's value is assigned to the destination's pointer, you must use `WithoutDereference`:
122+
123+
```go
124+
package main
125+
126+
import (
127+
"fmt"
128+
129+
"dario.cat/mergo"
130+
)
131+
132+
type Foo struct {
133+
A *string
134+
B int64
135+
}
136+
137+
func main() {
138+
first := "first"
139+
second := "second"
140+
src := Foo{
141+
A: &first,
142+
B: 2,
143+
}
144+
145+
dest := Foo{
146+
A: &second,
147+
B: 1,
148+
}
149+
150+
mergo.Merge(&dest, src, mergo.WithOverride, mergo.WithoutDereference)
151+
}
152+
```
153+
144154
Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field.
145155

146156
```go

0 commit comments

Comments
 (0)