« Back to Index

Godo re-build task

View original Gist on GitHub

Godofile.go

// It's important to realise that you'll only ever want to `go build` or `go run` a single file
// This confused me originally
// I could understand why my task's `Context` didn't get passed the name of the changed file
// The problem was I was just hacking little scripts together
// In practice, you'll be working within a project directory and you'll have a single entry point file

package main

import . "gopkg.in/godo.v1"

func tasks(p *Project) {
	p.Task("build", func(c *Context) error {
		return Run("go build")
	}).Watch("**/*.go")
}

func main() {
	Godo(tasks)
}