Skip to content

Commit c1085ef

Browse files
committed
Relates #381, #367: cleanup docs and warn if unparam algo was configured
1 parent 01fb823 commit c1085ef

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

.golangci.example.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ linters-settings:
128128
# with golangci-lint call it on a directory with the changed file.
129129
check-exported: false
130130
unparam:
131-
# call graph construction algorithm (cha, rta). In general, use cha for libraries,
132-
# and rta for programs with main packages. Default is cha.
133-
algo: cha
134-
135131
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
136132
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
137133
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,6 @@ linters-settings:
651651
# with golangci-lint call it on a directory with the changed file.
652652
check-exported: false
653653
unparam:
654-
# call graph construction algorithm (cha, rta). In general, use cha for libraries,
655-
# and rta for programs with main packages. Default is cha.
656-
algo: cha
657-
658654
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
659655
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
660656
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations

pkg/golinters/unparam.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ func (Unparam) Desc() string {
2222
func (lint Unparam) Run(ctx context.Context, lintCtx *linter.Context) ([]result.Issue, error) {
2323
us := &lintCtx.Settings().Unparam
2424

25+
if us.Algo != "cha" {
26+
lintCtx.Log.Warnf("`linters-settings.unparam.algo` isn't supported by the newest `unparam`")
27+
}
28+
2529
c := &check.Checker{}
2630
c.CheckExportedFuncs(us.CheckExported)
2731
c.Packages(lintCtx.Packages)

0 commit comments

Comments
 (0)