diff --git a/.deepsource.toml b/.deepsource.toml index 8a0681a..a8bc979 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -9,4 +9,4 @@ name = "go" enabled = true [analyzers.meta] - import_path = "github.com/imdario/mergo" \ No newline at end of file + import_path = "dario.cat/mergo" \ No newline at end of file diff --git a/README.md b/README.md index ffbbb62..7d0cf9f 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,19 @@ Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the 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). -### Important note +### Important notes + +#### 1.0.0 + +In [1.0.0](//github.com/imdario/mergo/releases/tag/1.0.0) Mergo moves to a vanity URL `dario.cat/mergo`. + +#### 0.3.9 Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds support for go modules. Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). +If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u dario.cat/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). ### Donations @@ -110,11 +116,11 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont ## Install - go get github.com/imdario/mergo + go get dario.cat/mergo // use in your .go code import ( - "github.com/imdario/mergo" + "dario.cat/mergo" ) ## Usage @@ -152,7 +158,7 @@ package main import ( "fmt" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type Foo struct { @@ -188,9 +194,9 @@ package main import ( "fmt" - "github.com/imdario/mergo" - "reflect" - "time" + "dario.cat/mergo" + "reflect" + "time" ) type timeTransformer struct { diff --git a/doc.go b/doc.go index fcd985f..7d96ec0 100644 --- a/doc.go +++ b/doc.go @@ -8,30 +8,36 @@ A helper to merge structs and maps in Golang. Useful for configuration default v Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). -Status +# Status It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. -Important note +# Important notes + +1.0.0 + +In 1.0.0 Mergo moves to a vanity URL `dario.cat/mergo`. + +0.3.9 Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. We added an optional/variadic argument so that it won't break the existing code. -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). +If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u dario.cat/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). -Install +# Install Do your usual installation procedure: - go get github.com/imdario/mergo + go get dario.cat/mergo - // use in your .go code - import ( - "github.com/imdario/mergo" - ) + // use in your .go code + import ( + "dario.cat/mergo" + ) -Usage +# Usage You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). @@ -59,7 +65,7 @@ Here is a nice example: import ( "fmt" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type Foo struct { @@ -81,7 +87,7 @@ Here is a nice example: // {two 2} } -Transformers +# Transformers Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? @@ -89,9 +95,9 @@ Transformers allow to merge specific types differently than in the default behav import ( "fmt" - "github.com/imdario/mergo" - "reflect" - "time" + "dario.cat/mergo" + "reflect" + "time" ) type timeTransformer struct { @@ -127,17 +133,16 @@ Transformers allow to merge specific types differently than in the default behav // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } } -Contact me +# Contact me If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario -About +# About Written by Dario Castañé: https://da.rio.hn -License +# License BSD 3-Clause license, as Go language. - */ package mergo diff --git a/go.mod b/go.mod index 4cc3d51..21f2faa 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/imdario/mergo +module dario.cat/mergo go 1.13 diff --git a/issue100_test.go b/issue100_test.go index 039123a..51b8949 100644 --- a/issue100_test.go +++ b/issue100_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type issue100s struct { diff --git a/issue104_test.go b/issue104_test.go index c07e5a8..fe353ea 100644 --- a/issue104_test.go +++ b/issue104_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type Record struct { diff --git a/issue121_test.go b/issue121_test.go index 0f36efd..04d1db4 100644 --- a/issue121_test.go +++ b/issue121_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue121WithSliceDeepCopy(t *testing.T) { diff --git a/issue123_test.go b/issue123_test.go index 9a9e4d8..f1cb1e4 100644 --- a/issue123_test.go +++ b/issue123_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue123(t *testing.T) { diff --git a/issue125_test.go b/issue125_test.go index 4e5cb63..c9258e9 100644 --- a/issue125_test.go +++ b/issue125_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type settings struct { diff --git a/issue129_test.go b/issue129_test.go index 3a1c691..ad20c75 100644 --- a/issue129_test.go +++ b/issue129_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue129Boolean(t *testing.T) { diff --git a/issue131_test.go b/issue131_test.go index f2c4ecd..a702063 100644 --- a/issue131_test.go +++ b/issue131_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type foz struct { diff --git a/issue136_test.go b/issue136_test.go index 0246ec9..2acab78 100644 --- a/issue136_test.go +++ b/issue136_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type embeddedTestA struct { diff --git a/issue138_test.go b/issue138_test.go index 70d7b29..843e590 100644 --- a/issue138_test.go +++ b/issue138_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) const issue138configuration string = ` diff --git a/issue143_test.go b/issue143_test.go index 0ea9306..d8a451d 100644 --- a/issue143_test.go +++ b/issue143_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue143(t *testing.T) { diff --git a/issue149_test.go b/issue149_test.go index b6857c9..79cd351 100644 --- a/issue149_test.go +++ b/issue149_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type user struct { diff --git a/issue174_test.go b/issue174_test.go index d06b68b..82e6571 100644 --- a/issue174_test.go +++ b/issue174_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type structWithBlankField struct { diff --git a/issue17_test.go b/issue17_test.go index 97bbd7d..1d111b0 100644 --- a/issue17_test.go +++ b/issue17_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue17MergeWithOverwrite(t *testing.T) { diff --git a/issue202_test.go b/issue202_test.go index df0620c..1ac8017 100644 --- a/issue202_test.go +++ b/issue202_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue202(t *testing.T) { diff --git a/issue209_test.go b/issue209_test.go index 00de234..0618d40 100644 --- a/issue209_test.go +++ b/issue209_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue209(t *testing.T) { diff --git a/issue220_test.go b/issue220_test.go index 164f5bd..8d4c5f8 100644 --- a/issue220_test.go +++ b/issue220_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue220(t *testing.T) { diff --git a/issue230_test.go b/issue230_test.go index 129f037..e4b3f29 100644 --- a/issue230_test.go +++ b/issue230_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) var testDataM = []struct { diff --git a/issue23_test.go b/issue23_test.go index d91bd79..9076466 100644 --- a/issue23_test.go +++ b/issue23_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type document struct { diff --git a/issue33_test.go b/issue33_test.go index cf92735..6474cb7 100644 --- a/issue33_test.go +++ b/issue33_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type Foo struct { diff --git a/issue38_test.go b/issue38_test.go index fdee7ff..32b3c91 100644 --- a/issue38_test.go +++ b/issue38_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type structWithoutTimePointer struct { diff --git a/issue50_test.go b/issue50_test.go index 2d32579..b23b0dd 100644 --- a/issue50_test.go +++ b/issue50_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type testStruct struct { diff --git a/issue52_test.go b/issue52_test.go index af65471..211ab7d 100644 --- a/issue52_test.go +++ b/issue52_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type structWithTime struct { diff --git a/issue61_test.go b/issue61_test.go index c94d693..cff180c 100644 --- a/issue61_test.go +++ b/issue61_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue61MergeNilMap(t *testing.T) { diff --git a/issue64_test.go b/issue64_test.go index c3d2772..ff5153f 100644 --- a/issue64_test.go +++ b/issue64_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type Student struct { diff --git a/issue66_test.go b/issue66_test.go index 643d4bb..f33c5a8 100644 --- a/issue66_test.go +++ b/issue66_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type PrivateSliceTest66 struct { diff --git a/issue83_test.go b/issue83_test.go index d10e892..13ccdbd 100644 --- a/issue83_test.go +++ b/issue83_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type issue83My struct { diff --git a/issue84_test.go b/issue84_test.go index b01ebf4..d4aedef 100644 --- a/issue84_test.go +++ b/issue84_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type DstStructIssue84 struct { diff --git a/issue89_test.go b/issue89_test.go index 1e138a9..4c89f34 100644 --- a/issue89_test.go +++ b/issue89_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestIssue89Boolean(t *testing.T) { diff --git a/issue90_test.go b/issue90_test.go index cb97537..bdd9d31 100644 --- a/issue90_test.go +++ b/issue90_test.go @@ -1,9 +1,10 @@ package mergo_test import ( - "github.com/imdario/mergo" "reflect" "testing" + + "dario.cat/mergo" ) type structWithStringMap struct { diff --git a/issueXXX_test.go b/issueXXX_test.go index e5f424f..77c18a1 100644 --- a/issueXXX_test.go +++ b/issueXXX_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) var testDataS = []struct { diff --git a/merge_test.go b/merge_test.go index 8d1c2fc..6e5fd86 100644 --- a/merge_test.go +++ b/merge_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type transformer struct { diff --git a/mergo_test.go b/mergo_test.go index 5e37d04..68c8aa5 100644 --- a/mergo_test.go +++ b/mergo_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/imdario/mergo" + "dario.cat/mergo" "gopkg.in/yaml.v3" ) diff --git a/pr211_test.go b/pr211_test.go index 09b87e9..00830ce 100644 --- a/pr211_test.go +++ b/pr211_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestMergeWithTransformerZeroValue(t *testing.T) { diff --git a/pr80_test.go b/pr80_test.go index 64f2a78..8dfae60 100644 --- a/pr80_test.go +++ b/pr80_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type mapInterface map[string]interface{} diff --git a/pr81_test.go b/pr81_test.go index 30abe74..903dd0d 100644 --- a/pr81_test.go +++ b/pr81_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) func TestMapInterfaceWithMultipleLayer(t *testing.T) { diff --git a/v039_bugs_test.go b/v039_bugs_test.go index 16a8cc0..04db29d 100644 --- a/v039_bugs_test.go +++ b/v039_bugs_test.go @@ -3,7 +3,7 @@ package mergo_test import ( "testing" - "github.com/imdario/mergo" + "dario.cat/mergo" ) type inner struct {