Skip to content

Instantly share code, notes, and snippets.

@ewalk153
Last active January 1, 2016 01:29
Show Gist options
  • Select an option

  • Save ewalk153/8073036 to your computer and use it in GitHub Desktop.

Select an option

Save ewalk153/8073036 to your computer and use it in GitHub Desktop.
Go guard file. Slightly more advanced version.
require 'guard'
require 'guard/plugin'
class Guard::Mygo < Guard::Plugin
def run_all
system 'go test ./...'
end
def run_on_changes(paths)
paths.each do |file|
file.sub!(/\.go\Z/, '_test.go') unless file.scan(/_test\.go/).length > 0
unless File.exist?(file)
puts "#{file} does not exist"
next
end
puts "Running #{file};"
system "go test #{file}"
puts
end
end
end
guard :mygo do
watch(%r{.*?.go})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment