mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
1. Use time.Time for expiration to simplify expiration checks. 2. Added a stopChan and a Stop method to properly stop the invalidateTask goroutine instead of directly changing values 3. Used Ticker in invalidateTask for periodic expiration checks 4. Leak Prevention: The invalidateTask() loop checks the TTL value before continuing. If the TTL is zero, the goroutine exits gracefully, preventing a memory leak. Signed-off-by: sulemaanhamza <sulemanhamza97@gmail.com>
Kubescape core package
// initialize kubescape
ks := core.NewKubescape()
// scan cluster
results, err := ks.Scan(&cautils.ScanInfo{})
// convert scan results to json
jsonRes, err := results.ToJson()