Skip to content

Commit 2512497

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 711bf0a commit 2512497

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
@@ -1747,25 +1747,57 @@ linters-settings:
17471747
begin: false
17481748

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

17701802

17711803
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)