Fanout

码农软件 · 软件分类 · 常用工具包 · 2019-08-16 19:28:41

软件介绍

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
}

本文地址:https://codercto.com/soft/d/12514.html

Learning Web App Development

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》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

html转js在线工具
html转js在线工具

html转js在线工具