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://www.codercto.com/soft/d/12514.html

Graph Algorithms

Graph Algorithms

Shimon Even / Cambridge University Press / 2011-9-19 / USD 32.99

Shimon Even's Graph Algorithms, published in 1979, was a seminal introductory book on algorithms read by everyone engaged in the field. This thoroughly revised second edition, with a foreword by Richa......一起来看看 《Graph Algorithms》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具