diff --git a/lib/overcommit/hook/pre_commit/go_lint.rb b/lib/overcommit/hook/pre_commit/go_lint.rb index e5b93c3b..3e0dfc3c 100644 --- a/lib/overcommit/hook/pre_commit/go_lint.rb +++ b/lib/overcommit/hook/pre_commit/go_lint.rb @@ -4,8 +4,15 @@ module Overcommit::Hook::PreCommit # @see https://github.com/golang/lint class GoLint < Base def run - result = execute(command, args: applicable_files) - output = result.stdout + result.stderr + output = '' + + # golint doesn't accept multiple file arguments if + # they belong to different packages + applicable_files.each do |gofile| + result = execute(command, args: Array(gofile)) + output += result.stdout + result.stderr + end + # Unfortunately the exit code is always 0 return :pass if output.empty?