Skip to content

Commit 10fd3e0

Browse files
committed
feat: update to uncalled v0.7.1
Update to uncalled v0.7.1 which adds more checkers, adds the ability to handle more called types including direct calls in defers. This adds the following new rules: - http Response.Body.Close() - context context.CancelFunc()
1 parent c745f9b commit 10fd3e0

File tree

4 files changed

+53
-17
lines changed

4 files changed

+53
-17
lines changed

.golangci.reference.yml

+47-15
Original file line numberDiff line numberDiff line change
@@ -1743,25 +1743,57 @@ linters-settings:
17431743
begin: false
17441744

17451745
uncalled:
1746+
default-category: uncalled
17461747
rules:
1747-
# Check for uncalled Rows.Err
1748-
- name: sql.Rows
1749-
disabled: false
1750-
severity: warning
1748+
# Checks for missing sql Rows.Err() calls.
1749+
- name: sql-rows-err
1750+
# Default: false
1751+
disabled: true
1752+
category: sql
17511753
packages:
17521754
- database/sql
17531755
- github.com/jmoiron/sqlx
1754-
call:
1755-
methods: []
1756-
results:
1757-
- type: .Rows
1758-
pointer: true
1759-
- type: error
1760-
pointer: false
1761-
expect:
1762-
method: .Err
1763-
resultIndex: 0
1764-
args: []
1756+
methods: []
1757+
results:
1758+
- type: .Rows
1759+
pointer: true
1760+
expect:
1761+
call: .Err
1762+
args: []
1763+
- type: error
1764+
pointer: false
1765+
# Checks for missing http Reponse.Body.Close() calls.
1766+
- name: http-response-body-close
1767+
# Default: false
1768+
disabled: true
1769+
category: http
1770+
packages:
1771+
- net/http
1772+
methods: []
1773+
results:
1774+
- type: .Response
1775+
pointer: true
1776+
expect:
1777+
call: .Body.Close
1778+
args: []
1779+
- type: error
1780+
pointer: false
1781+
# Checks for missing context CancelFunc() calls.
1782+
- name: context-cancel
1783+
# Default: false
1784+
disabled: true
1785+
category: context
1786+
packages:
1787+
- context
1788+
methods: []
1789+
results:
1790+
- type: .Context
1791+
pointer: false
1792+
- type: .CancelFunc
1793+
pointer: false
1794+
expect:
1795+
call:
1796+
args: []
17651797

17661798

17671799
usestdlibvars:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ require (
9393
github.com/spf13/viper v1.12.0
9494
github.com/ssgreg/nlreturn/v2 v2.2.1
9595
github.com/stbenjam/no-sprintf-host-port v0.1.1
96-
github.com/stevenh/go-uncalled v0.5.0
96+
github.com/stevenh/go-uncalled v0.7.1
9797
github.com/stretchr/testify v1.8.1
9898
github.com/tdakkota/asciicheck v0.1.1
9999
github.com/tetafro/godot v1.4.11

go.sum

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/uncalled.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func NewUncalled(settings *config.UncalledSettings) *goanalysis.Linter {
12-
a := uncalled.NewAnalyzer(settings)
12+
a := uncalled.NewAnalyzer(uncalled.ConfigOpt(settings))
1313
return goanalysis.NewLinter(
1414
a.Name,
1515
a.Doc,

0 commit comments

Comments
 (0)