I'm happy to submit to your attention the result of my first experiment
with go: makengo.
http://github.com/remogatto/makengo
When I switched from ruby to go there was a thing I particularly missed: a
build program à la rake[1]. So, I decided to make an attempt trying to
roughly reproduce rake's dsl in go and I ended up with what follows.
Needless to say that this software is in an early alpha stage of
development (poor test coverage, messy code, etc.) but it should be enough
to give you an idea.
If you, guys, think that it's worth continuing with the experiment I'll be
happy to dedicate more spare time to it. Eventually, let's show your
interest either giving comments, feedbacks and suggestions,
watching/forking the github repo, etc. I'm new to Go so any comments will
be appreciated!
[1] - http://rake.rubyforge.org
# The DSL
## Define a simple task without dependencies
Task("Hello", func() { fmt.Println("Hello!") })
## Define two dependent tasks (order of definition doesn't matter)
Task("Joe", func() { fmt.Println("Joe") })
Task("Hello", func() { fmt.Println("Hello ") }).DependsOn("Joe")
## Add descriptions to tasks
Describe("Print hello.")
Task("Hello", func() { fmt.Println("Hello!") })
## Define a default task among a set of defined tasks (not yet implemented)
Task("Hello", func() { fmt.Println("Hello!") })
Default("Hello")
# Makengo file
Tasks are defined inside a file named Makengo and embraced by func init()
{ ... }:
## Makengo file example
package main
import (
"fmt"
. "makengo"
)
func init() {
Describe("Print hello.")
Task("Hello", func() { fmt.Println("Hello!") })
}
# Tasks execution and command-line
Tasks are invoked using makengo executable:
$ makengo # Run the default task if any
$ makengo Hello # Output "Hello!"
$ makengo Hello Joe # Output "Hello Joe"
$ makengo -T # Show task descriptions
# Concurrency
I desired to look at one of go's neatest feature: goroutines. Concurrency
is exploited following these rules:
1. Independent tasks run concurrently.
2. 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.
Waiting for your feedbacks!
Cheers,
--
Andrea Fazzi @ alcacoop.it
Read my blog at http://freecella.blogspot.com
Follow me on http://twitter.com/remogatto