Skip to content

Add golangci-lint config enabling stricter linters#81

Closed
andrew wants to merge 5 commits into
google:mainfrom
git-pkgs:add-golangci-config
Closed

Add golangci-lint config enabling stricter linters#81
andrew wants to merge 5 commits into
google:mainfrom
git-pkgs:add-golangci-config

Conversation

@andrew
Copy link
Copy Markdown

@andrew andrew commented May 22, 2026

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.

andrew added 5 commits March 15, 2026 08:59
- 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.
@andrew
Copy link
Copy Markdown
Author

andrew commented May 22, 2026

Apologies, opened against the wrong remote. Closing.

@andrew andrew closed this May 22, 2026
@andrew andrew deleted the add-golangci-config branch May 22, 2026 10:28
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.

1 participant