From f413f1436d62533385915c4ac4595ff38eea9185 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Fri, 4 Oct 2019 13:22:41 +0200 Subject: [PATCH] Handle the ValueSpec when trying to resolve an AST tree node Signed-off-by: Cosmin Cojocar --- resolve.go | 2 +- resolve_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resolve.go b/resolve.go index 9030133..12743c7 100644 --- a/resolve.go +++ b/resolve.go @@ -73,7 +73,7 @@ func resolveCallExpr(n *ast.CallExpr, c *Context) bool { return false } -// TryResolve will attempt, given a subtree starting at some ATS node, to resolve +// TryResolve will attempt, given a subtree starting at some AST node, to resolve // all values contained within to a known constant. It is used to check for any // unknown values in compound expressions. func TryResolve(n ast.Node, c *Context) bool { diff --git a/resolve_test.go b/resolve_test.go index 233f49b..035ba90 100644 --- a/resolve_test.go +++ b/resolve_test.go @@ -91,6 +91,7 @@ var _ = Describe("Resolve ast node to concrete value", func() { Expect(target).ShouldNot(BeNil()) Expect(gosec.TryResolve(target, ctx)).Should(BeTrue()) }) + It("should successfully resolve value spec", func() { var value *ast.ValueSpec pkg := testutils.NewTestPackage() @@ -111,7 +112,6 @@ var _ = Describe("Resolve ast node to concrete value", func() { Expect(value).ShouldNot(BeNil()) Expect(gosec.TryResolve(value, ctx)).Should(BeTrue()) }) - }) })