mikespook/gearman-go — pull request #37 by wickning1 (2014-05-20 20:26:36+00:00)
Title: Allow ID generator to hash the payload

The unique ID passed to gearman is used to avoid duplicate work. I want to make use of that feature, so I need the unique ID to be a hash of funcname+payload.

I went ahead and implemented an IdGenerator type in my own project to do this, but I need the interface to support sending the funcname and payload as parameters, so I changed your code as well. It should be harmless to include in your project and may help others, hence this pull request.

For reference, my IdGenerator implementation looks like this (has not been tested and I'm very new to Go):

```go
type gearmanIdGen gearmanclient.IdGenerator
func (ci *gearmanIdGen) Id(funcname, payload string) string {
return hex.encodeToString(sha1.Sum(funcname+payload))
}
```

You may want to consider this behavior as the default behavior, assuming I'm correct that gearman uses the unique id for this purpose.