Repository navigation
gohawk v0.5.0
Breaking changes
- Test files are no longer analyzed. gohawk checks production code only. The
-gohawk-include-testsoption is removed, and_test.gofiles are never analyzed or reported. - Analyzer options are removed. Every check has one behavior in every project.
goroutineownership.mode,resourcelifetime.contracts, and the other analyzer flags no longer exist; choose what runs with the selection flags. - Retired checks:
- the
channelsafetyanalyzer resourcelifetime/use-after-releaselockorder/recursive-acquire- the four experimental
producerlifecyclechecks:stopped-loop-send,unclosed-range,unsignalled-receiver, andunreceived-return
- the
processownership/missing-waitis now experimental. It no longer runs by default; select it or use-tier=experimental.- The extended tier is removed. Checks are
core(the default) orexperimental. - The debugging views moved under
gohawk dump:gohawk dump ssa,facts, andheap(which replaces-regions), plus the newbudget,locks, andtraceviews. Their-testsoption is removed.
Diagnostics
- Findings lead with the message and draw their evidence as labeled source spans, joining evidence from one file into a single snippet.
- Each finding cites the return path that leaks, the branch that decides it, and the loop or declaration involved, and ends with a one-line fix.
- Diagnostics link to their analyzer's documentation page, and
lockordernames locks by their source text.
Analysis
deferinloopreports a deferredresp.Body.Close()inside a loop when the response was acquired in that iteration.resourcelifetimetracks both ends ofos.Pipeand resources appended to local slices. It also treatsClient.Get,Post, andPostFormresponses as owned bodies, and credits helpers proven to close a resource, including helpers that release every element of a collection.resourcelifetimesettles a response whoseBodyis nil, and a helper that cleans up only when a Boolean flag selects it.cancellationownershipproves cancellation through imported helper summaries and credits a returned struct that owns the cancel function.- Fewer false positives across
lockorder,goroutineownership, andresourcelifetime, from better handling of locally built values, receiver loads, generic instantiations, and unread done channels. - Results no longer depend on the order in which analyzers are scheduled.
Full Changelog: v0.4.0...v0.5.0