Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Go Grunt
loadTasks = require 'load-grunt-tasks'
module.exports = (grunt) ->
env = process.env
cwd = process.cwd()
root = "#{cwd}/../../go"
src = "#{root}/src/#{env.src}"
command = (cmd, opts) ->
command: cmd
options:
execOptions: opts
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
env:
go:
GOPATH: root
PATH: "#{env.PATH}:#{root}/bin"
watch:
go:
files: ['../**/*.go']
tasks: ['shell:sync', 'shell:test']
shell:
env: command: 'env'
clean: command: "rm -Rf #{root}"
source: command: "mkdir -p #{src}"
sync: command: "rsync -ar ../ #{src}/ --exclude ci"
get: command("go get -v -t ./...", cwd: src)
test: command("go test -v ./...", cwd: src)
loadTasks grunt
grunt.option 'force', true
grunt.registerTask 'install', ['env:go', 'shell:clean', 'shell:source', 'shell:sync', 'shell:get']
grunt.registerTask 'test', ['env:go', 'shell:test']
grunt.registerTask 'echo', ['env:go', 'shell:env']
grunt.registerTask 'default', ['env', 'watch:go']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.