class Overcommit::Hook::PreCommit::GoLint
Runs `golint` against any modified Golang files.
Public Instance Methods
run()
click to toggle source
# File lib/overcommit/hook/pre_commit/go_lint.rb, line 8 def run 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? # example message: # path/to/file.go:1:1: Error message extract_messages( output.split("\n"), /^(?<file>(?:\w:)?[^:]+):(?<line>\d+)/ ) end