From c1085ef5a2a7e81af36e38a0ef7723fbce5fa07a Mon Sep 17 00:00:00 2001
From: Denis Isaev <denis@golangci.com>
Date: Mon, 11 Feb 2019 08:56:49 +0300
Subject: [PATCH] Relates #381, #367: cleanup docs and warn if unparam algo was
 configured

---
 .golangci.example.yml    | 4 ----
 README.md                | 4 ----
 pkg/golinters/unparam.go | 4 ++++
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/.golangci.example.yml b/.golangci.example.yml
index 6c87bf82..54234d3b 100644
--- a/.golangci.example.yml
+++ b/.golangci.example.yml
@@ -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
diff --git a/README.md b/README.md
index caa208a0..5d384e33 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/pkg/golinters/unparam.go b/pkg/golinters/unparam.go
index 2b67cc7c..661efe36 100644
--- a/pkg/golinters/unparam.go
+++ b/pkg/golinters/unparam.go
@@ -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)