v0.13.1
·
8 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Fixes to declscope shrink. Upgrading from v0.13.0 found each of these in a real repository. The analyzer is unchanged, and upgrading needs no edit.
Every fix below makes shrink report less, or offer fewer fixes. Where v0.13.0 offered a fix that broke a build, a go vet or a JSON output, v0.13.1 withholds it or does not report the declaration at all.
Fixes that no longer break anything
| Case | v0.13.0 | v0.13.1 |
|---|---|---|
A struct with a key:"value" field tag |
Unexported its fields, which go vet rejects for json and xml, and encoding/json drops silently |
The struct escapes, whole: a tag says a marshaller reads it. A tag on a struct it holds without naming counts too, an alias of one included |
| A type an exported API returns, takes or holds, where the API is used from another package | Unexported the type, leaving the API handing out a type its callers cannot name | Not reported: the other package holds values of it |
| The same, where the API is only used inside its package | As above | Reported, with no fix while the API keeps its name. The API and the type go together when both are fixed |
An alias an API returns (type QueryHandler = baseHandler[R]) |
Unexported the alias | Kept as the API's own name |
| A type embedded more than one level down | The new field name could make a selector ambiguous and break the build | Every type that holds it at any depth is checked |
An external test writing an embedded field by position (w.Outer{3}) |
Unexported the field's type, and the test stopped compiling | The literal is a use of the type |
One run of -fix converges
- Names are claimed only once it is settled which types keep their names.
- When two fixes lower to one name (
WrapandWRAP), only one of them is withheld. - A report without a fix reads the same after the fix as before it.
- When two fixes lower to one name (
- An
//declscope:ignore overexportedover a type that turns out used is reported unused.
Reasons for a package not judged
The reason printed on stderr for a package shrink does not judge now says which of these applies:
- the package is outside
internal/ - its
internal/parent lies above the module - a nested module may import it; the nested module is named, since one under
testdata/or_tools/is easy to miss
Full changelog: v0.13.0...v0.13.1