From 36645d1bff99dd9fe9c5f8f2991623fe169523e8 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Thu, 2 Feb 2023 09:18:54 +0000 Subject: [PATCH] encoding/openapi: remove unused code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When refactoring cue/load, I noticed that some pieces of code were unused, which makes it less obvious what kinds of things can be done. I used `staticcheck` to point out many other places in the code that are unused. This is one of those places. I feel it's better to remove this code even if it might be used in the future (it's always there to be found in the git history). Signed-off-by: Roger Peppe Change-Id: I7a2ee05fcc8a36140e07bea8162f97d0854e26ec Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/549295 TryBot-Result: CUEcueckoo Unity-Result: CUEcueckoo Reviewed-by: Daniel Martí --- encoding/openapi/build.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go index 97634b7e66e..b68b906c70d 100644 --- a/encoding/openapi/build.go +++ b/encoding/openapi/build.go @@ -44,7 +44,6 @@ type buildContext struct { nameFunc func(inst cue.Value, path cue.Path) string descFunc func(v cue.Value) string fieldFilter *regexp.Regexp - evalDepth int // detect cycles when resolving references schemas *OrderedMap @@ -519,28 +518,6 @@ outer: return a } -func countNodes(v cue.Value) (n int) { - switch op, a := v.Expr(); op { - case cue.OrOp, cue.AndOp: - for _, v := range a { - n += countNodes(v) - } - n += len(a) - 1 - default: - switch v.Kind() { - case cue.ListKind: - for i, _ := v.List(); i.Next(); { - n += countNodes(i.Value()) - } - case cue.StructKind: - for i, _ := v.Fields(); i.Next(); { - n += countNodes(i.Value()) + 1 - } - } - } - return n + 1 -} - // isConcrete reports whether v is concrete and not a struct (recursively). // structs are not supported as the result of a struct enum depends on how // conjunctions and disjunctions are distributed. We could consider still doing