- 授权协议: Apache
- 开发语言: Google Go
- 操作系统: 跨平台
- 软件首页: https://github.com/sunfmin/fanout
软件介绍
Fanout 可以让编写平行代码更加容易。Fanout 的代码是可以重复使用的,所以你可以很容易地就写下平行代码,而不用担心 fatal error: all goroutines are asleep - deadlock!
示例代码:
for _, word := range domainWords {
if strings.TrimSpace(word) == "" {
continue
}
py := pinyin.Convert(word)
pydowncase := strings.ToLower(py)
domain := pydowncase + ".com"
outr, err := domainAvailable(word, domain)
if err != nil {
fmt.Println("Error: ", err)
continue
}
if outr.available {
fmt.Printf("[Ohh Yeah] %s %s\n", outr.word, outr.domain)
continue
}
fmt.Printf("\t\t\t %s %s %s\n", outr.word, outr.domain, outr.summary)
}
type checkResult struct {
word string
domain string
available bool
summary string
}
func domainAvailable(word string, domain string) (ch checkResult, err error) {
var summary string
var output []byte
ch.word = word
ch.domain = domain
cmd := exec.Command("whois", domain)
output, err = cmd.Output()
if err != nil {
fmt.Println(err)
return
}
outputstring := string(output)
if strings.Contains(outputstring, "No match for \"") {
ch.available = true
return
}
summary = firstLineOf(outputstring, "Registrant Name") + " => "
summary = summary + firstLineOf(outputstring, "Expiration Date")
ch.summary = summary
return
}
Learning Web App Development
Semmy Purewal / O'Reilly Media / 2014-3-3 / USD 29.99
Grasp the fundamentals of web application development by building a simple database-backed app from scratch, using HTML, JavaScript, and other open source tools. Through hands-on tutorials, this pract......一起来看看 《Learning Web App Development》 这本书的介绍吧!
