This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| package main | |
| // This is a basic example of running an nsqd instance embedded. It creates | |
| // and runs an nsqd with all of the default options, and then produces | |
| // and consumes a single message. You are probably better off running a | |
| // standalone instance, but embedding it can simplify deployment and is | |
| // useful in testing. | |
| // See https://github.com/nsqio/nsq/blob/master/nsqd/options.go and | |
| // https://github.com/nsqio/nsq/blob/master/apps/nsqd/nsqd.go for |
| var errNotFound = errors.New("Cannot find a .git directory") | |
| func dotGitDir(dir string) (string, error) { | |
| gitDir := filepath.Join(dir, ".git") | |
| if gitDir == "/.git" { | |
| return "", errNotFound | |
| } | |
| if _, err := os.Stat(gitDir); err != nil { | |
| return dotGitDir(path.Dir(dir)) | |
| } |
| // Copyright 2012 Junqing Tan <[email protected]> and The Go Authors | |
| // Use of this source code is governed by a BSD-style | |
| // Part of source code is from Go fcgi package | |
| // Fix bug: Can't recive more than 1 record untill FCGI_END_REQUEST 2012-09-15 | |
| // By: wofeiwo | |
| package fcgiclient | |
| import ( |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer