Relates #381, #367: cleanup docs and warn if unparam algo was configured

This commit is contained in:
Denis Isaev 2019-02-11 08:56:49 +03:00
parent 01fb8231f9
commit c1085ef5a2
No known key found for this signature in database
GPG Key ID: A36A0EC8E27A1A01
3 changed files with 4 additions and 8 deletions

View File

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

View File

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

View File

@ -22,6 +22,10 @@ func (Unparam) Desc() string {
func (lint Unparam) Run(ctx context.Context, lintCtx *linter.Context) ([]result.Issue, error) {
us := &lintCtx.Settings().Unparam
if us.Algo != "cha" {
lintCtx.Log.Warnf("`linters-settings.unparam.algo` isn't supported by the newest `unparam`")
}
c := &check.Checker{}
c.CheckExportedFuncs(us.CheckExported)
c.Packages(lintCtx.Packages)