From 6be09cfdb6a1836eb34c991f0af9f34fef9a19e1 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 20 Jan 2023 16:26:13 +0100 Subject: [PATCH] renamed step/undoStep -> push/pop --- bundle/schema/schema.go | 4 ++-- bundle/schema/schema_test.go | 6 +++--- bundle/schema/tracker.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index 240ba87c..ef939972 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -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 } diff --git a/bundle/schema/schema_test.go b/bundle/schema/schema_test.go index a5161a3f..8edb7568 100644 --- a/bundle/schema/schema_test.go +++ b/bundle/schema/schema_test.go @@ -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") } diff --git a/bundle/schema/tracker.go b/bundle/schema/tracker.go index b084c322..f8b52aab 100644 --- a/bundle/schema/tracker.go +++ b/bundle/schema/tracker.go @@ -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)