Add golangci-lint config enabling stricter linters#81
Closed
andrew wants to merge 5 commits into
Closed
Conversation
- bump go.mod from go 1.12 to go 1.25 - apply go fix: slices.Sort, slices.Contains, strings.Cut, strings.SplitSeq, range-over-int, max builtin, doc comment format - replace deprecated ioutil calls with os equivalents - remove unnecessary loop variable captures (Go 1.22+) - update build constraint to //go:build syntax - disable GC during builtin scanner init to reduce startup latency - change module path to github.com/git-pkgs/licensecheck
Builtin scanner init parsed 374 LRE patterns and built a 615K-state DFA at runtime (~400ms). Now gen_data.go serializes the DFA to builtin.dfa and scan.go deserializes it at init (~3ms).
Reduces builtin.dfa from 10.5MB to 3MB. Decompression adds ~40ms to init but that's still a 10x improvement over the old 400ms runtime DFA build.
markdownAnchorSize and markdownLinkSize scanned forward through the
entire remaining input on each call. Input consisting of many {# or
](http:// triggers without closers caused each call to scan to end of
input, giving O(n^2) total work in Dict.split.
Cap the scan at 256 bytes for anchors and 2048 bytes for link targets,
and abort early on the next trigger byte ({ and ] respectively). Real
markdown anchors and link targets are well within these bounds.
Enables the same linter set used across other git-pkgs applications (gocritic, gocognit, gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, errcheck) and configures goconst to skip test files.
Author
|
Apologies, opened against the wrong remote. Closing. |
This file contains hidden or 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
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.
Enables the same linter set used across other git-pkgs applications (gocritic, gocognit, gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, errcheck) and configures goconst to skip test files.
Note: this surfaces existing lint findings that will need fixing separately.