class Overcommit::Hook::PreCommit::GoFmt

Runs go fmt for all modified Go files

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/go_fmt.rb, line 6
def run
  errors = []
  applicable_files.each do |file|
    result = execute(command, args: [file])
    errors << (result.stdout + result.stderr) unless result.success?
  end
  return :pass if errors.empty?

  [:fail, errors.join("\n")]
end