From 21c2590ba8570e5be7a39bcb416a0cd7618d135d Mon Sep 17 00:00:00 2001 From: Denis Isaev Date: Sat, 22 Dec 2018 15:55:53 +0300 Subject: [PATCH] Fix #318: better validate linters and help commands --- pkg/commands/help.go | 4 ++++ pkg/commands/linters.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkg/commands/help.go b/pkg/commands/help.go index 9fb2a877..fed59c12 100644 --- a/pkg/commands/help.go +++ b/pkg/commands/help.go @@ -44,6 +44,10 @@ func printLinterConfigs(lcs []linter.Config) { } func (e Executor) executeLintersHelp(cmd *cobra.Command, args []string) { + if len(args) != 0 { + e.log.Fatalf("Usage: golangci-lint help linters") + } + var enabledLCs, disabledLCs []linter.Config for _, lc := range e.DBManager.GetAllSupportedLinterConfigs() { if lc.EnabledByDefault { diff --git a/pkg/commands/linters.go b/pkg/commands/linters.go index fada8084..22500489 100644 --- a/pkg/commands/linters.go +++ b/pkg/commands/linters.go @@ -31,6 +31,10 @@ func IsLinterInConfigsList(name string, linters []linter.Config) bool { } func (e *Executor) executeLinters(cmd *cobra.Command, args []string) { + if len(args) != 0 { + e.log.Fatalf("Usage: golangci-lint linters") + } + enabledLCs, err := e.EnabledLintersSet.Get() if err != nil { log.Fatalf("Can't get enabled linters: %s", err)