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

feat(go): support go.mod in Go 1.17+ #1985

Merged
merged 2 commits into from
Apr 13, 2022
Merged

feat(go): support go.mod in Go 1.17+ #1985

merged 2 commits into from
Apr 13, 2022

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Apr 13, 2022

Description

Description

Go 1.17+ adds indirect dependencies to go.mod. This PR parses go.mod as well as go.sum and merges them according to the Go version in go.mod.

  • Go 1.17+
    • it takes only go.mod and ignores go.sum.
  • Go 1.16 or less
    • it takes direct dependencies in go.mod and indirect dependencies in go.sum.

It reduces unused dependencies as shown below.

Before

$ ./fanal fs --skip-dirs analyzer --skip-dirs artifact --skip-dirs config .
...
gomod (go.sum): 697

After

$ ./fanal fs --skip-dirs analyzer --skip-dirs artifact --skip-dirs config .
...
gomod (go.mod): 164

Related issues

Related PRs

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@knqyf263 knqyf263 self-assigned this Apr 13, 2022
@knqyf263 knqyf263 requested a review from afdesk April 13, 2022 12:36
@knqyf263 knqyf263 changed the title feat(golang): support go.mod in Go 1.17+ feat(go): support go.mod in Go 1.17+ Apr 13, 2022
@knqyf263 knqyf263 marked this pull request as ready for review April 13, 2022 13:01
@knqyf263 knqyf263 merged commit d77dbe8 into main Apr 13, 2022
@knqyf263 knqyf263 deleted the gomod branch April 13, 2022 13:02
@knqyf263 knqyf263 mentioned this pull request Apr 13, 2022
7 tasks
liamg pushed a commit that referenced this pull request Jun 7, 2022
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.

Go module false positives
2 participants