summaryrefslogtreecommitdiff
path: root/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go')
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go
deleted file mode 100644
index 9d651553d78..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2018, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE.md file.
-
-package cmpopts
-
-import (
- "github.com/google/go-cmp/cmp"
-)
-
-type xformFilter struct{ xform cmp.Option }
-
-func (xf xformFilter) filter(p cmp.Path) bool {
- for _, ps := range p {
- if t, ok := ps.(cmp.Transform); ok && t.Option() == xf.xform {
- return false
- }
- }
- return true
-}
-
-// AcyclicTransformer returns a Transformer with a filter applied that ensures
-// that the transformer cannot be recursively applied upon its own output.
-//
-// An example use case is a transformer that splits a string by lines:
-// AcyclicTransformer("SplitLines", func(s string) []string{
-// return strings.Split(s, "\n")
-// })
-//
-// Had this been an unfiltered Transformer instead, this would result in an
-// infinite cycle converting a string to []string to [][]string and so on.
-func AcyclicTransformer(name string, xformFunc interface{}) cmp.Option {
- xf := xformFilter{cmp.Transformer(name, xformFunc)}
- return cmp.FilterPath(xf.filter, xf.xform)
-}