mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Handle the ValueSpec when trying to resolve an AST tree node
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
c1970ff5c9
commit
f413f1436d
2 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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())
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue