Sha256: 77c6dee51d9bd8132f3bc64d4e2d3c6b1b0c7e2e082cdf5a0dcd9822e29f849f

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `go vet` against any modified Golang files.
  #
  # @see https://godoc.org/code.google.com/p/go-zh.tools/cmd/vet
  class GoVet < Base
    def run
      result = execute(command + applicable_files)
      return :pass if result.success?

      if result.stderr =~ /no such tool "vet"/
        return :fail, "`go tool vet` is not installed#{install_command_prompt}"
      end

      # example message:
      #   path/to/file.go:7: Error message
      extract_messages(
        result.stderr.split("\n"),
        /^(?<file>[^:]+):(?<line>\d+)/
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overcommit-0.27.0 lib/overcommit/hook/pre_commit/go_vet.rb
overcommit-0.26.0 lib/overcommit/hook/pre_commit/go_vet.rb