Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace ioutil=>io; update linter #1211

Merged
merged 2 commits into from
Sep 16, 2022
Merged

refactor: replace ioutil=>io; update linter #1211

merged 2 commits into from
Sep 16, 2022

Conversation

spiffcs
Copy link
Contributor

@spiffcs spiffcs commented Sep 16, 2022

Summary

Syft's DEVELOPING.md instructs the user to boostrap tools and run make

The default make step has a couple of errors when running out of the box.

The first is make lint:
Screen Shot 2022-09-16 at 1 29 53 PM

These errors are correct by changing the directives at the top of these files to the newer nolint:all

The second is where io/util is considered deprecated in the latest Golang release. These instances have been updated to their latest os or io equivlants.

Abandoned linters have also been disabled per the warnings from the golangci tool:
Screen Shot 2022-09-16 at 1 32 08 PM

Changes

  • remove deprecated linters that have been abandoned
  • replace usage of ioutil => io/os upgrades
  • update std library copied files to new lint directive

Follow up

  • updating developer.md with better flow diagrams, explanation of what default make does, and shorter introduction commands to get new users up to speed

Signed-off-by: Christopher Phillips [email protected]

Signed-off-by: Christopher Phillips <[email protected]>
	    remove deprecated linters that have been abandoned
	    replace usage of ioutil => io/os upgrades

Signed-off-by: Christopher Phillips <[email protected]>
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just one question about adding the removed linters to the comments

@@ -10,7 +10,6 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the other linters be added to the commented section below?

Copy link
Contributor Author

@spiffcs spiffcs Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the ones that were relevant to the generic issue. The ones that have been deleted are:

[WARN] x is deprecated. Replaced by unused.

I can include them commented out if we want to ever incorporate them again if they are picked up by a maintainer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no need if they're deprecated 👍

@github-actions
Copy link

Benchmark Test Results

Benchmark results from the latest changes vs base branch
name                                                       old time/op    new time/op    delta
ImagePackageCatalogers/alpmdb-cataloger-2                    11.7ms ± 1%    15.4ms ±24%  +32.43%  (p=0.008 n=5+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2              1.36ms ± 8%    1.60ms ± 3%  +17.69%  (p=0.008 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2            3.40ms ± 1%    4.05ms ± 1%  +19.02%  (p=0.008 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2    1.10ms ± 1%    1.30ms ± 1%  +17.80%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         772µs ± 1%     902µs ± 1%  +16.91%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                     931µs ± 2%    1064µs ± 4%  +14.30%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpm-db-cataloger-2                    1.34ms ± 1%    1.53ms ± 0%  +13.78%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      15.1ms ± 1%    18.0ms ± 3%  +18.76%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.34ms ± 4%    1.52ms ± 2%  +13.40%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2          2.30µs ± 1%    2.71µs ± 2%  +17.77%  (p=0.008 n=5+5)
ImagePackageCatalogers/dotnet-deps-cataloger-2               1.44ms ± 1%    1.69ms ± 1%  +17.13%  (p=0.008 n=5+5)
ImagePackageCatalogers/portage-cataloger-2                    726µs ± 1%     863µs ± 4%  +18.81%  (p=0.008 n=5+5)

name                                                       old alloc/op   new alloc/op   delta
ImagePackageCatalogers/alpmdb-cataloger-2                    5.26MB ± 0%    5.26MB ± 0%     ~     (p=0.690 n=5+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2               202kB ± 0%     202kB ± 0%     ~     (p=0.135 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2             945kB ± 0%     944kB ± 0%     ~     (p=0.421 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     214kB ± 0%     214kB ± 0%     ~     (p=0.246 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         158kB ± 0%     158kB ± 0%     ~     (p=0.738 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                     203kB ± 0%     203kB ± 0%     ~     (p=0.151 n=5+5)
ImagePackageCatalogers/rpm-db-cataloger-2                     302kB ± 0%     302kB ± 0%     ~     (p=0.310 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      3.44MB ± 0%    3.44MB ± 0%     ~     (p=0.548 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.25MB ± 0%    1.25MB ± 0%     ~     (p=0.151 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2            672B ± 0%      672B ± 0%     ~     (all equal)
ImagePackageCatalogers/dotnet-deps-cataloger-2                369kB ± 0%     369kB ± 0%     ~     (p=0.095 n=5+5)
ImagePackageCatalogers/portage-cataloger-2                    136kB ± 0%     136kB ± 0%     ~     (p=0.151 n=5+5)

name                                                       old allocs/op  new allocs/op  delta
ImagePackageCatalogers/alpmdb-cataloger-2                     85.7k ± 0%     85.7k ± 0%     ~     (p=0.167 n=5+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2               4.25k ± 0%     4.25k ± 0%     ~     (p=1.000 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2             16.6k ± 0%     16.6k ± 0%   -0.04%  (p=0.024 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     5.53k ± 0%     5.53k ± 0%     ~     (p=0.571 n=5+4)
ImagePackageCatalogers/javascript-package-cataloger-2         3.32k ± 0%     3.32k ± 0%     ~     (all equal)
ImagePackageCatalogers/dpkgdb-cataloger-2                     4.60k ± 0%     4.60k ± 0%     ~     (all equal)
ImagePackageCatalogers/rpm-db-cataloger-2                     8.13k ± 0%     8.13k ± 0%     ~     (all equal)
ImagePackageCatalogers/java-cataloger-2                       57.5k ± 0%     57.5k ± 0%   +0.02%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                      5.43k ± 0%     5.43k ± 0%     ~     (p=1.000 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2            15.0 ± 0%      15.0 ± 0%     ~     (all equal)
ImagePackageCatalogers/dotnet-deps-cataloger-2                7.27k ± 0%     7.27k ± 0%     ~     (all equal)
ImagePackageCatalogers/portage-cataloger-2                    3.59k ± 0%     3.59k ± 0%     ~     (all equal)

@spiffcs spiffcs enabled auto-merge (squash) September 16, 2022 17:46
@spiffcs spiffcs merged commit b483167 into main Sep 16, 2022
@spiffcs spiffcs deleted the developer-upgrade branch September 16, 2022 17:58
spiffcs added a commit that referenced this pull request Sep 16, 2022
* main:
  refactor: replace ioutil=>io; update linter (#1211)
spiffcs added a commit to luhring/syft that referenced this pull request Sep 19, 2022
* main:
  bug: remove chance for panic; provide default attestation path (anchore#1214)
  refactor: update Makefile organization; update DEVELOPING.md instructions (anchore#1212)
  refactor: replace ioutil=>io; update linter (anchore#1211)
  Update bootstrap tools to latest versions. (anchore#1204)
  Add gosimports (anchore#1205)
  refactor: move formats from internal into syft module (anchore#1172)
  warn on errors from RPM DB parsing (anchore#1200)
  docs: improve Singularity image source docs (anchore#1190)

Signed-off-by: Christopher Phillips <[email protected]>
spiffcs added a commit that referenced this pull request Sep 19, 2022
aiwantaozi pushed a commit to aiwantaozi/syft that referenced this pull request Oct 20, 2022
spiffcs added a commit that referenced this pull request Oct 21, 2022
spiffcs added a commit that referenced this pull request Oct 21, 2022
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants