mirror of https://github.com/databricks/cli.git
renamed step/undoStep -> push/pop
This commit is contained in:
parent
9599e63ffb
commit
6be09cfdb6
|
@ -130,12 +130,12 @@ func safeToSchema(golangType reflect.Type, docs *Docs, traceId string, tracker *
|
|||
return nil, fmt.Errorf("cycle detected")
|
||||
}
|
||||
|
||||
tracker.step(golangType, traceId)
|
||||
tracker.push(golangType, traceId)
|
||||
props, err := toSchema(golangType, docs, tracker)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tracker.undoStep(golangType)
|
||||
tracker.pop(golangType)
|
||||
return props, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -665,12 +665,12 @@ func TestErrorWithTrace(t *testing.T) {
|
|||
err := tracker.errWithTrace("with empty trace")
|
||||
assert.ErrorContains(t, err, "[ERROR] with empty trace. traversal trace: root")
|
||||
|
||||
tracker.step(dummyType, "resources")
|
||||
tracker.push(dummyType, "resources")
|
||||
err = tracker.errWithTrace("with depth = 1")
|
||||
assert.ErrorContains(t, err, "[ERROR] with depth = 1. traversal trace: root -> resources")
|
||||
|
||||
tracker.step(dummyType, "pipelines")
|
||||
tracker.step(dummyType, "datasets")
|
||||
tracker.push(dummyType, "pipelines")
|
||||
tracker.push(dummyType, "datasets")
|
||||
err = tracker.errWithTrace("with depth = 4")
|
||||
assert.ErrorContains(t, err, "[ERROR] with depth = 4. traversal trace: root -> resources -> pipelines -> datasets")
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ func (t *tracker) hasCycle(golangType reflect.Type) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
func (t *tracker) step(nodeType reflect.Type, jsonName string) {
|
||||
func (t *tracker) push(nodeType reflect.Type, jsonName string) {
|
||||
t.seenTypes[nodeType] = struct{}{}
|
||||
t.debugTrace.PushBack(jsonName)
|
||||
}
|
||||
|
||||
func (t *tracker) undoStep(nodeType reflect.Type) {
|
||||
func (t *tracker) pop(nodeType reflect.Type) {
|
||||
back := t.debugTrace.Back()
|
||||
t.debugTrace.Remove(back)
|
||||
delete(t.seenTypes, nodeType)
|
||||
|
|
Loading…
Reference in New Issue