-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
dev: updates internal code borrowed from Go #5098
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
ldez
changed the title
dev: updates the code the internal code borrowed from Go
dev: updates code of the internal code borrowed from Go
Oct 31, 2024
ldez
changed the title
dev: updates code of the internal code borrowed from Go
dev: updates internal code borrowed from Go
Oct 31, 2024
ldez
force-pushed
the
feat/cache-sync-go
branch
3 times, most recently
from
November 1, 2024 00:28
ffd5e64
to
9be932c
Compare
ldez
force-pushed
the
feat/cache-sync-go
branch
from
November 1, 2024 18:10
9be932c
to
0f97a4c
Compare
bombsimon
approved these changes
Nov 2, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the internal code borrowed from Go.
The main element is the
cache
package.The initial version from #699 (2019) is a mix between go1.12 and go1.13 (more details inside
internal/cache/readme.md
).The main modifications are about error handling: the official Go cache implementation ignores many errors, and the implementation inside Golangci-lint reports those "hidden" errors.
I reverted minor changes and isolated custom modifications (but not all modifications can be isolated) to minimize divergences before synchronizing the code with each Go version.
I spent a lot of time analyzing the code to be able to make the right updates.
The packages
mmap
,quoted
are just copies of the Go code without any changes.The package
testenv
has been trimmed to just keep one function (avoid complex copy for imports) without other changes.The package
renameio
has been removed from Go and "replaced" bylockedfile
, I used the modulegh.neting.cc/rogpeppe/go-internal
instead of copying the code.There is one commit by topic and one commit by Go version.
Side effect:
The support of the experimental programmatic cache (
GOLANGCI_LINT_CACHEPROG
).Note 1:
I think the code of the PR is not reviewable as a classic PR because it's synchronization with the Go code.
The code from Go must not be changed to ease future synchronization, and some custom codes are written in a style to ease the diff.
Note 2:
I did some benchmarks and I didn't notice any performance improvements or regression after the update.
Note 3:
If you are asking if it was painful to update, the answer is yes: it was long and painful 😄
But future synchronization will be "easier", at least easier than this one.
This PR is the first part of the refactoring of the golangci-lint core, but don't expect another PR quickly because, currently, the code is pure spaghetti 🍝.
This is a long-term goal. Regularly, I try this refactor. Each time, I learn more, but still not enough to be confident.
Closes #4986
Related to golang/go#59719