lib/plugins/pre_commit/checks/go.rb in pre-commit-0.26.0 vs lib/plugins/pre_commit/checks/go.rb in pre-commit-0.27.0
- old
+ new
@@ -2,28 +2,16 @@
module PreCommit
module Checks
class Go < Plugin
- def call(staged_files)
- staged_files = staged_files.grep(/\.go$/)
- return if staged_files.empty?
-
- errors = staged_files.map { |file| run_check(file) }.compact
- return if errors.empty?
-
- errors.join("\n")
+ def self.includes
+ [:gobuild, :gofmt]
end
- def run_check(file)
- cmd = "gofmt -l #{file} 2>&1"
- result = %x[ #{cmd} ]
- cmd = "go build -o /dev/null #{file} 2>&1"
- result << %x[ #{cmd} ]
- end
def self.description
- "Detects bad Go formatting and compiler errors"
+ "Plugins for Go code"
end
end
end
end