Makengo (make'n'go) is a build program written in go and inspired to ruby rake.
When I switched from ruby to go there was a thing I particularly missed: a build program à la rake. So, I decided to make an attempt trying to roughly reproduce rake's DSL in go and I ended up with what follows.
Please note that this software is in an early alpha stage of development. If you find it interesting feel free to send me feedbacks or better to fork it and send me patches ;)
$ git clone http://github.com/remogatto/makengo
$ cd makengo
$ make install
Task("Hello", func() { fmt.Println("Hello!") })
Task("Joe", func() { fmt.Println("Joe") })
Task("Hello", func() { fmt.Println("Hello ") }).DependsOn("Joe")
Desc("Print hello.")
Task("Hello", func() { fmt.Println("Hello!") })
Task("Hello", func() { fmt.Println("Hello!") })
Default("Hello")
Tasks are defined inside a file named Makengo and embraced by a init() function.
package main
import (
"fmt"
. "makengo"
)
func init() {
Desc("Print hello.")
Task("Hello", func() { fmt.Println("Hello!") })
}
Tasks are invoked using makengo executable:
$ makengo # Run the default task if any
$ makengo Hello # Run "Hello" task
$ makengo Hello Joe # Run "Hello" and "Joe" tasks
$ makengo -T # Show task descriptions
$ makengo -h # Show usage information
In makengo, Go concurrency is exploited following these rules:
-
Independent tasks run concurrently.
-
If task1 depends on (task2, task3) and (task2, task3) are independent tasks then (task2, task3) run concurrently and task1 waits for (task2, task3) to finish their job.
Special thanks to
-
Nicolas Sebrecht for bug reports, feedback and a lesson about git-am ;)
-
The Go mailing list for an useful discussion about Go and DSLs
Copyright (c) 2010 Andrea Fazzi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.