mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	Update go dep (#1560)
This fix updates go dep with `dep ensure --update` as well as the following: - Removed github.com/ugorji/go restriction in Gopkg.toml (fixes #1557) - Added github.com/flynn/go-shlex in Makefile (neede by Caddy, maybe removed later) This fix fixes #1557 Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
		
							
								
								
									
										7
									
								
								vendor/github.com/imdario/mergo/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/imdario/mergo/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,2 +1,7 @@
 | 
			
		||||
language: go
 | 
			
		||||
install: go get -t
 | 
			
		||||
install:
 | 
			
		||||
  - go get -t
 | 
			
		||||
  - go get golang.org/x/tools/cmd/cover
 | 
			
		||||
  - go get github.com/mattn/goveralls
 | 
			
		||||
script:
 | 
			
		||||
  - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								vendor/github.com/imdario/mergo/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								vendor/github.com/imdario/mergo/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,17 +2,16 @@
 | 
			
		||||
 | 
			
		||||
A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements.
 | 
			
		||||
 | 
			
		||||
Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region Marche.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche.
 | 
			
		||||
 | 
			
		||||
## Status
 | 
			
		||||
 | 
			
		||||
It is ready for production use. It works fine after extensive use in the wild.
 | 
			
		||||
It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild).
 | 
			
		||||
 | 
			
		||||
[![Build Status][1]][2]
 | 
			
		||||
[![GoDoc][3]][4]
 | 
			
		||||
[![GoCard][5]][6]
 | 
			
		||||
[![Coverage Status][7]][8]
 | 
			
		||||
 | 
			
		||||
[1]: https://travis-ci.org/imdario/mergo.png
 | 
			
		||||
[2]: https://travis-ci.org/imdario/mergo
 | 
			
		||||
@@ -20,19 +19,41 @@ It is ready for production use. It works fine after extensive use in the wild.
 | 
			
		||||
[4]: https://godoc.org/github.com/imdario/mergo
 | 
			
		||||
[5]: https://goreportcard.com/badge/imdario/mergo
 | 
			
		||||
[6]: https://goreportcard.com/report/github.com/imdario/mergo
 | 
			
		||||
[7]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master
 | 
			
		||||
[8]: https://coveralls.io/github/imdario/mergo?branch=master
 | 
			
		||||
 | 
			
		||||
### Latest release
 | 
			
		||||
 | 
			
		||||
[Release 0.3.1](https://github.com/imdario/mergo/releases/tag/0.3.1) is an important release because it changes `Merge()`and `Map()` signatures to support [transformers](#transformers). An optional/variadic argument has been added, so it won't break existing code.
 | 
			
		||||
 | 
			
		||||
### Important note
 | 
			
		||||
 | 
			
		||||
Mergo is intended to assign **only** zero value fields on destination with source value. Since April 6th it works like this. Before it didn't work properly, causing some random overwrites. After some issues and PRs I found it didn't merge as I designed it. Thanks to [imdario/mergo#8](https://github.com/imdario/mergo/pull/8) overwriting functions were added and the wrong behavior was clearly detected.
 | 
			
		||||
 | 
			
		||||
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 (I hope it won't!) in existing projects after the change (release 0.2.0).
 | 
			
		||||
 | 
			
		||||
### Mergo in the wild
 | 
			
		||||
 | 
			
		||||
- [docker/docker](https://github.com/docker/docker/)
 | 
			
		||||
- [moby/moby](https://github.com/moby/moby)
 | 
			
		||||
- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)
 | 
			
		||||
- [vmware/dispatch](https://github.com/vmware/dispatch)
 | 
			
		||||
- [Shopify/themekit](https://github.com/Shopify/themekit)
 | 
			
		||||
- [imdario/zas](https://github.com/imdario/zas)
 | 
			
		||||
- [matcornic/hermes](https://github.com/matcornic/hermes)
 | 
			
		||||
- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go)
 | 
			
		||||
- [kataras/iris](https://github.com/kataras/iris)
 | 
			
		||||
- [michaelsauter/crane](https://github.com/michaelsauter/crane)
 | 
			
		||||
- [go-task/task](https://github.com/go-task/task)
 | 
			
		||||
- [sensu/uchiwa](https://github.com/sensu/uchiwa)
 | 
			
		||||
- [ory/hydra](https://github.com/ory/hydra)
 | 
			
		||||
- [sisatech/vcli](https://github.com/sisatech/vcli)
 | 
			
		||||
- [dairycart/dairycart](https://github.com/dairycart/dairycart)
 | 
			
		||||
- [projectcalico/felix](https://github.com/projectcalico/felix)
 | 
			
		||||
- [resin-os/balena](https://github.com/resin-os/balena)
 | 
			
		||||
- [go-kivik/kivik](https://github.com/go-kivik/kivik)
 | 
			
		||||
- [Telefonica/govice](https://github.com/Telefonica/govice)
 | 
			
		||||
- [supergiant/supergiant](supergiant/supergiant)
 | 
			
		||||
- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce)
 | 
			
		||||
- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy)
 | 
			
		||||
- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel)
 | 
			
		||||
- [EagerIO/Stout](https://github.com/EagerIO/Stout)
 | 
			
		||||
- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api)
 | 
			
		||||
- [russross/canvasassignments](https://github.com/russross/canvasassignments)
 | 
			
		||||
@@ -50,7 +71,7 @@ If you were using Mergo **before** April 6th 2015, please check your project wor
 | 
			
		||||
- [thoas/picfit](https://github.com/thoas/picfit)
 | 
			
		||||
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
 | 
			
		||||
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
 | 
			
		||||
- [Iris Web Framework](https://github.com/kataras/iris)
 | 
			
		||||
- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
@@ -71,7 +92,7 @@ if err := mergo.Merge(&dst, src); err != nil {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Also, you can merge overwriting values using the transformer WithOverride.
 | 
			
		||||
Also, you can merge overwriting values using the transformer `WithOverride`.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
if err := mergo.Merge(&dst, src, WithOverride); err != nil {
 | 
			
		||||
@@ -79,7 +100,7 @@ if err := mergo.Merge(&dst, src, WithOverride); err != nil {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
if err := mergo.Map(&dst, srcMap); err != nil {
 | 
			
		||||
@@ -151,6 +172,7 @@ func (t timeTransfomer) Transformer(typ reflect.Type) func(dst, src reflect.Valu
 | 
			
		||||
					dst.Set(src)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/imdario/mergo/issue33_test.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/imdario/mergo/issue33_test.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -28,6 +28,6 @@ func TestIssue33Merge(t *testing.T) {
 | 
			
		||||
		t.Errorf("Error while merging: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
	if dest.Str != toMerge.Str {
 | 
			
		||||
		t.Errorf("dest.Str should have been override: dest.Str(%v) == toMerge.Str(%v)", dest.Str, toMerge.Str)
 | 
			
		||||
		t.Errorf("dest.Str should have been override: dest.Str(%v) != toMerge.Str(%v)", dest.Str, toMerge.Str)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/imdario/mergo/merge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/imdario/mergo/merge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -54,7 +54,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
 | 
			
		||||
		visited[h] = &visit{addr, typ, seen}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if config.transformers != nil {
 | 
			
		||||
	if config.transformers != nil && !isEmptyValue(dst) {
 | 
			
		||||
		if fn := config.transformers.Transformer(dst.Type()); fn != nil {
 | 
			
		||||
			err = fn(dst, src)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										50
									
								
								vendor/github.com/imdario/mergo/merge_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								vendor/github.com/imdario/mergo/merge_test.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
package mergo
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type transformer struct {
 | 
			
		||||
	m map[reflect.Type]func(dst, src reflect.Value) error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *transformer) Transformer(t reflect.Type) func(dst, src reflect.Value) error {
 | 
			
		||||
	if fn, ok := s.m[t]; ok {
 | 
			
		||||
		return fn
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type foo struct {
 | 
			
		||||
	s   string
 | 
			
		||||
	Bar *bar
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type bar struct {
 | 
			
		||||
	i int
 | 
			
		||||
	s map[string]string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestMergeWithTransformerNilStruct(t *testing.T) {
 | 
			
		||||
	a := foo{s: "foo"}
 | 
			
		||||
	b := foo{Bar: &bar{i: 2, s: map[string]string{"foo": "bar"}}}
 | 
			
		||||
	if err := Merge(&a, &b, WithOverride, WithTransformers(&transformer{
 | 
			
		||||
		m: map[reflect.Type]func(dst, src reflect.Value) error{
 | 
			
		||||
			reflect.TypeOf(&bar{}): func(dst, src reflect.Value) error {
 | 
			
		||||
				// Do sthg with Elem
 | 
			
		||||
				t.Log(dst.Elem().FieldByName("i"))
 | 
			
		||||
				t.Log(src.Elem())
 | 
			
		||||
				return nil
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	})); err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	if a.s != "foo" {
 | 
			
		||||
		t.Fatalf("b not merged in properly: a.s.Value(%s) != expected(%s)", a.s, "foo")
 | 
			
		||||
	}
 | 
			
		||||
	if a.Bar == nil {
 | 
			
		||||
		t.Fatalf("b not merged in properly: a.Bar shouldn't be nil")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/imdario/mergo/mergo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/imdario/mergo/mergo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -47,6 +47,8 @@ func isEmptyValue(v reflect.Value) bool {
 | 
			
		||||
		return v.Float() == 0
 | 
			
		||||
	case reflect.Interface, reflect.Ptr, reflect.Func:
 | 
			
		||||
		return v.IsNil()
 | 
			
		||||
	case reflect.Invalid:
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user