Repository navigation
v0.2.0
Highlights
New rules for pointer fields
Two rules report a pointer field used as optional, so that it becomes mo.Option. Both are off by default.
| Rule | Reports | Turn it on with |
|---|---|---|
field-nil-store |
nil stored into a pointer field: S{F: nil}, S{1, nil}, s.F = nil, or a nil that reaches the store on some path |
-field-nil-store |
field-nil-compare |
A pointer field compared with nil: s.F == nil, s.F != nil, or case nil |
-field-nil-compare |
Important
Turn on field-nil-store together with exhaustruct. A field left out of a composite literal is not seen by molint. The exhaustruct linter makes you write it as F: nil. Then molint reports it.
field-nil-compare does not need exhaustruct. It also finds a field that only a decoder such as json.Unmarshal leaves nil.
Only fields declared in the package count. An embedded field and a field in a generated file do not.
An agent skill in the binary
The binary carries molint-authoring, a skill for an AI agent writing code under molint. It says how to fix each rule with samber/mo, which fixes only hide a problem, and when an ignore is right.
molint skill install # the agents already set up in this project
molint skill install --agent claude-code --scope user
molint skill list # where it is, and whether it is currentgh skill install mpyw/molint molint-authoring installs the same skill without the binary.
-V=full prints the release
molint -V=full now prints the release, such as 0.2.0. It used to print devel for every binary. go vet -vettool reads the same line to identify the tool.
Breaking change
molint.ErrNoSSA is removed. No driver could return it, since a driver runs the analyzer's Requires first. Only a hand-built analysis.Pass without SSA met it.
Documentation
- The rule tables in the README say what each row means, in place of "The same".
- The README and design/rules.md list a gap that every rule already had. No rule analyzes the initializer of a package-level variable, such as
var s = S{P: nil}.
Pull requests
- #9 feat: add field-nil-store and field-nil-compare
- #10 feat: ship the molint-authoring skill, and answer -V=full with the release
Full Changelog: v0.1.0...v0.2.0