diff --git a/_example/main.go b/_example/main.go index 3ca9f86..6773dd8 100644 --- a/_example/main.go +++ b/_example/main.go @@ -7,13 +7,8 @@ import ( "reflect" "github.com/InVisionApp/conjungo" - log "github.com/sirupsen/logrus" ) -func init() { - log.SetLevel(log.InfoLevel) -} - func main() { fmt.Println("Simple map merge") SimpleMap() @@ -56,7 +51,7 @@ func SimpleMap() { err := conjungo.Merge(&targetMap, sourceMap, nil) if err != nil { - log.Error(err) + fmt.Println(err) } marshalIndentPrint(targetMap) @@ -86,7 +81,7 @@ func SimpleStruct() { err := conjungo.Merge(&targetStruct, sourceStruct, nil) if err != nil { - log.Error(err) + fmt.Println(err) } marshalIndentPrint(targetStruct) @@ -131,7 +126,7 @@ func CustomMerge() { err := conjungo.Merge(&targetMap, sourceMap, opts) if err != nil { - log.Error(err) + fmt.Println(err) } marshalIndentPrint(targetMap) @@ -172,7 +167,7 @@ func CustomStructMerge() { err := conjungo.Merge(&target, source, opts) if err != nil { - log.Error(err) + fmt.Println(err) } marshalIndentPrint(target) @@ -195,7 +190,7 @@ func NoOverwrite() { opts.Overwrite = false err := conjungo.Merge(&targetMap, sourceMap, opts) if err != nil { - log.Error(err) + fmt.Println(err) } marshalIndentPrint(targetMap) @@ -256,7 +251,7 @@ func FromJSON() { err := conjungo.Merge(&targetJSON, sourceJSON, opts) if err != nil { - log.Error(err) + fmt.Println(err) } fmt.Println(targetJSON) diff --git a/go.mod b/go.mod index d2003ba..b3047e4 100644 --- a/go.mod +++ b/go.mod @@ -3,5 +3,4 @@ module github.com/birdayz/conjungo require ( github.com/onsi/ginkgo v1.7.0 github.com/onsi/gomega v1.4.3 - github.com/sirupsen/logrus v1.2.0 ) diff --git a/go.sum b/go.sum index 889541e..cb35de2 100644 --- a/go.sum +++ b/go.sum @@ -1,32 +1,18 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= diff --git a/merge_suite_test.go b/merge_suite_test.go index e9f2630..907dfcb 100644 --- a/merge_suite_test.go +++ b/merge_suite_test.go @@ -3,16 +3,11 @@ package conjungo import ( "testing" - "github.com/sirupsen/logrus" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func TestMergeSuite(t *testing.T) { - // reduce the noise when testing - logrus.SetLevel(logrus.FatalLevel) - RegisterFailHandler(Fail) RunSpecs(t, "Merge Suite") } diff --git a/mfunc.go b/mfunc.go index 659f7a1..65cb8ba 100644 --- a/mfunc.go +++ b/mfunc.go @@ -3,8 +3,6 @@ package conjungo import ( "fmt" "reflect" - - "github.com/sirupsen/logrus" ) // A MergeFunc defines how two items are merged together. It should accept a reflect.Value @@ -99,7 +97,7 @@ func mergeMap(t, s reflect.Value, o *Options) (v reflect.Value, err error) { }() for _, k := range keys { - logrus.Debugf("MERGE T<>S '%s' :: %v <> %v", k, t.MapIndex(k), s.MapIndex(k)) + fmt.Printf("MERGE T<>S '%s' :: %v <> %v\n", k, t.MapIndex(k), s.MapIndex(k)) val, err := merge(t.MapIndex(k), s.MapIndex(k), o) if err != nil { return reflect.Value{}, fmt.Errorf("key '%s': %v", k, err) @@ -139,7 +137,7 @@ func mergeStruct(t, s reflect.Value, o *Options) (reflect.Value, error) { for i := 0; i < valS.NumField(); i++ { fieldT := newT.Field(i) - logrus.Debugf("merging struct field %s", fieldT) + fmt.Printf("merging struct field %s\n", fieldT) // field is addressable because it's created above. So this means it is unexported. if !fieldT.CanSet() { @@ -160,7 +158,7 @@ func mergeStruct(t, s reflect.Value, o *Options) (reflect.Value, error) { } if !merged.IsValid() { - logrus.Warnf("merged value is invalid for field %s. Falling back to default merge: %v <> %v", + fmt.Printf("merged value is invalid for field %s. Falling back to default merge: %v <> %v\n", newT.Type().Field(i).Name, valT.Field(i), valS.Field(i)) // if merge returned an invalid value, fallback to a default merge for the field