本文整理汇总了Golang中flag.Int64函数的典型用法代码示例。如果您正苦于以下问题:Golang Int64函数的具体用法?Golang Int64怎么用?Golang Int64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Int64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: decodeRefArg
func decodeRefArg(name, typeName string) (interface{}, error) {
switch strings.ToLower(typeName) {
case "*bool":
newValue := flag.Bool(name, app.DefaultBoolValue, name)
return newValue, nil
case "bool":
newValue := flag.Bool(name, app.DefaultBoolValue, name)
return *newValue, nil
case "*string":
newValue := flag.String(name, app.DefaultStringValue, name)
return *newValue, nil
case "string":
newValue := flag.String(name, app.DefaultStringValue, name)
return *newValue, nil
case "*time.duration":
newValue := flag.Duration(name, app.DefaultDurationValue, name)
return *newValue, nil
case "time.duration":
newValue := flag.Duration(name, app.DefaultDurationValue, name)
return *newValue, nil
case "*float64":
newValue := flag.Float64(name, app.DefaultFloat64Value, name)
return *newValue, nil
case "float64":
newValue := flag.Float64(name, app.DefaultFloat64Value, name)
return *newValue, nil
case "*int":
newValue := flag.Int(name, app.DefaultIntValue, name)
return *newValue, nil
case "int":
newValue := flag.Int(name, app.DefaultIntValue, name)
return *newValue, nil
case "*int64":
newValue := flag.Int64(name, app.DefaultInt64Value, name)
return *newValue, nil
case "int64":
newValue := flag.Int64(name, app.DefaultInt64Value, name)
return *newValue, nil
case "*uint":
newValue := flag.Uint(name, app.DefaultUIntValue, name)
return *newValue, nil
case "uint":
newValue := flag.Uint(name, app.DefaultUIntValue, name)
return *newValue, nil
case "*uint64":
newValue := flag.Uint64(name, app.DefaultUInt64Value, name)
return *newValue, nil
case "uint64":
newValue := flag.Uint64(name, app.DefaultUInt64Value, name)
return *newValue, nil
}
return nil, fmt.Errorf("unknow type %s for argument %s", typeName, name)
}
开发者ID:goatcms,项目名称:goat-core,代码行数:60,代码来源:injector.go
示例2: main
func main() {
total := flag.Int64("total", 0, "Total block size in MB")
block := flag.Int64("block", 100, "block init size in MB [dd bs]. count will be 1")
parallel := flag.Int64("parallel", 2, "size")
device := flag.String("device", "/dev/xvdf", "name")
offset := flag.Int64("offset", 0, "starting offset that will be used to skip")
flag.Parse()
p := make(chan bool, *parallel)
c := *offset
for c*(*block) < *total {
go func(c int64) {
ifd := fmt.Sprintf("if=%s", *device)
of := fmt.Sprintf("of=/dev/null")
bs := fmt.Sprintf("bs=%dM", *block)
count := fmt.Sprintf("count=1")
skip := fmt.Sprintf("skip=%d", c)
out, err := exec.Command("dd", ifd, of, bs, count, skip).CombinedOutput()
if err != nil {
log.Println(err, out)
}
<-p
}(c)
p <- true
c++
fmt.Println("offset:", c, "total:", c*(*block), "MB")
}
for i := int64(0); i < *parallel; i++ {
p <- true
}
}
开发者ID:kavehmz,项目名称:garbage,代码行数:34,代码来源:main.go
示例3: main
func main() {
lat := flag.Float64("lat", 0, "latitude of occurrence")
lng := flag.Float64("lng", 0, "longitude of occurrence")
explain := flag.Bool("explain", true, "print useful information")
date := flag.Int64("date", 0, "unix second: 1467558491")
period := flag.Int64("period", 14, "number of days into the past to generate weather: 14")
flag.Parse()
store, err := noaa.NewWeatherStore(
"/Users/mph/Desktop/phenograph-raw-data/stations.txt",
"/Users/mph/Desktop/phenograph-raw-data/ghcnd_all/ghcnd_all",
false,
)
if err != nil {
panic(err)
}
records, err := store.Nearest(
*lat,
*lng,
noaa.Elements{noaa.ElementTMAX, noaa.ElementPRCP, noaa.ElementTMIN},
noaa.TimesFromUnixArray(*date, *period),
*explain,
)
if err != nil {
panic(err)
}
fmt.Println("RECORDS", utils.JsonOrSpew(records))
return
}
开发者ID:heindl,项目名称:raincollector,代码行数:34,代码来源:main.go
示例4: main
func main() {
// get all the vars
numNewpix := flag.Int64("numnewpix", -1, "Mandatory -- The number of NewPix to click for, 0 for infinite, negative for displaying help.")
xserver := flag.String("xserver", os.Getenv("DISPLAY"), "Which X server to send the clicks to (defaults to the one this command is ran from).")
startpix := flag.Int64("currentpix", 1, "Which pix the game is on.")
npbotmNP := flag.Int64("npbotmnp", 400, "How many mNP the NewPixBots need to avoid being ninja'd (0 if there's no ninja).")
helpwanted := flag.Bool("help", false, "Print the help message.")
flag.Parse()
// verify parameter validity and display help if anything's invalid (or if help's requested)
if *helpwanted || *numNewpix < 0 || *startpix < 1 || *npbotmNP < 0 {
usage()
os.Exit(1)
}
// make clicker
ch := make(chan bool, 1)
go cmdRepeater(ch, func() *exec.Cmd { return clickNCmd(5, *xserver) })
// finish current newpix
curpix := *startpix
var margin int64 = 3 // how many extra mNP on either side of newpixbot ninja'ing time to wait
wakemNP := *npbotmNP + margin
sleepmNP := 1000 - margin
if mNP := currentmNP(curpix); mNP < sleepmNP {
clickLoopIteration(curpix, wakemNP, sleepmNP, ch)
}
for curpix++; curpix < *startpix+*numNewpix; curpix++ {
clickLoopIteration(curpix, wakemNP, sleepmNP, ch)
}
}
开发者ID:refola,项目名称:golang,代码行数:31,代码来源:sandclick.go
示例5: main
func main() {
providersFile := flag.String("providers_file", "providers.json", "Path to oembed providers json file")
workerCount := flag.Int64("worker_count", 1000, "Amount of workers to start")
host := flag.String("host", "localhost", "Host to listen on")
port := flag.Int("port", 8000, "Port to listen on")
maxHTMLBytesToRead := flag.Int64("html_bytes_to_read", 50000, "How much data to read from URL if it's an html page")
maxBinaryBytesToRead := flag.Int64("binary_bytes_to_read", 4096, "How much data to read from URL if it's NOT an html page")
waitTimeout := flag.Int("wait_timeout", 7, "How much time to wait for/fetch response from remote server")
whiteListRanges := flag.String("whitelist_ranges", "", "What IP ranges to allow. Example: 178.25.32.1/8")
blackListRanges := flag.String("blacklist_ranges", "", "What IP ranges to disallow. Example: 178.25.32.1/8")
flag.Parse()
buf, err := ioutil.ReadFile(*providersFile)
if err != nil {
panic(err)
}
var whiteListNetworks []*net.IPNet
if len(*whiteListRanges) > 0 {
if whiteListNetworks, err = stringsToNetworks(strings.Split(*whiteListRanges, " ")); err != nil {
panic(err)
}
}
var blackListNetworks []*net.IPNet
if len(*blackListRanges) > 0 {
if blackListNetworks, err = stringsToNetworks(strings.Split(*blackListRanges, " ")); err != nil {
panic(err)
}
}
oe := oembed.NewOembed()
oe.ParseProviders(bytes.NewReader(buf))
workers := make([]tunny.TunnyWorker, *workerCount)
for i := range workers {
p := url2oembed.NewParser(oe)
p.MaxHTMLBodySize = *maxHTMLBytesToRead
p.MaxBinaryBodySize = *maxBinaryBytesToRead
p.WaitTimeout = time.Duration(*waitTimeout) * time.Second
p.BlacklistedIPNetworks = blackListNetworks
p.WhitelistedIPNetworks = whiteListNetworks
workers[i] = &(apiWorker{Parser: p})
}
pool, err := tunny.CreateCustomPool(workers).Open()
if err != nil {
log.Fatal(err)
}
defer pool.Close()
workerPool = pool
startServer(*host, *port, *waitTimeout)
}
开发者ID:undefzx,项目名称:proclink-api,代码行数:59,代码来源:server.go
最后编辑: kuteng 文档更新时间: 2021-08-23 19:14 作者:kuteng