praetorian-inc / gokart

A static analysis tool for securing Go code
Apache License 2.0
2.18k stars 110 forks source link

Update removal of bad packages from package list. #66

Closed jessesomerville closed 2 years ago

jessesomerville commented 2 years ago

Updated the way that bad packages are removed from the package list to be more efficient. The previous method ran in O(n*m) time (n = num of all packages, m = num of bad packages), and the updated method runs in O(n) and also cleans up some of the surrounding code to make it more readable.

Side note, this constant is deprecated and it's recommended to update to explicitly declaring which fields you need.

isp1r0 commented 2 years ago

Merging Update Removal of Bad Packages. Local testing completed.

isp1r0 commented 2 years ago

Test validated:

go test -v
=== RUN TestRemoveBadPackages === RUN TestRemoveBadPackages/no_bad_packages === RUN TestRemoveBadPackages/one_bad_package

: === RUN TestRemoveBadPackages/all_packages_are_bad

:

:

: --- PASS: TestRemoveBadPackages (0.00s) --- PASS: TestRemoveBadPackages/no_bad_packages (0.00s) --- PASS: TestRemoveBadPackages/one_bad_package (0.00s) --- PASS: TestRemoveBadPackages/all_packages_are_bad (0.00s) PASS ok github.com/praetorian-inc/gokart/run 1.080s