本文整理汇总了Golang中flag.UintVar函数的典型用法代码示例。如果您正苦于以下问题:Golang UintVar函数的具体用法?Golang UintVar怎么用?Golang UintVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了UintVar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
    now := uint(time.Now().Unix())
    yesterday := uint(time.Now().Add(-24 * time.Hour).Unix())
    flag.UintVar(&from, "from", yesterday, "Unix epoch time of the beginning of the requested interval. (default: 24 hours ago)")
    flag.UintVar(&until, "until", now, "Unix epoch time of the end of the requested interval. (default: now)")
    flag.Parse()

    if flag.NArg() != 1 {
        usage()
    }

    path := flag.Args()[0]
    fromTime := uint32(from)
    untilTime := uint32(until)

    w, err := whisper.Open(path)
    if err != nil {
        log.Fatal(err)
    }

    interval, points, err := w.FetchUntil(fromTime, untilTime)

    fmt.Printf("Values in interval %+v\n", interval)
    for i, p := range points {
        fmt.Printf("%d %v\n", i, p)
    }
    return
}

开发者ID:kisielk,项目名称:whisper-go,代码行数:28,代码来源:whisper-fetch.go

示例2: main

func main() {
    flag.StringVar(&url, "u", "", "URL to load test (required)")
    flag.StringVar(&method, "m", "GET", "HTTP method")
    flag.UintVar(&concurrency, "c", 10, "number of concurrent requests")
    flag.UintVar(&requests, "n", 1000, "number of total requests to make")
    flag.UintVar(&timeout, "t", 15, "request timeout in seconds")
    flag.StringVar(&regions, "r", "us-east-1,eu-west-1,ap-northeast-1", "AWS regions to run in (comma separated, no spaces)")
    flag.Parse()

    if url == "" {
        flag.Usage()
        os.Exit(0)
    }

    test, testerr := goad.NewTest(&goad.TestConfig{
        URL:            url,
        Concurrency:    concurrency,
        TotalRequests:  requests,
        RequestTimeout: time.Duration(timeout) * time.Second,
        Regions:        strings.Split(regions, ","),
        Method:         method,
    })
    if testerr != nil {
        fmt.Println(testerr)
        os.Exit(1)
    }

    var finalResult queue.RegionsAggData
    defer printSummary(&finalResult)

    sigChan := make(chan os.Signal, 1)
    signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbox

    start(test, &finalResult, sigChan)
}

开发者ID:ernesto-jimenez,项目名称:goad,代码行数:35,代码来源:cli.go

示例3: init

func init() {
    flag.IntVar(&port, "port", 80, "Webserver port.")
    flag.IntVar(&port, "p", 80, "Webserver port (shorthand).")

    flag.BoolVar(&passThrough, "through", false, "Pass serial input to STDOUT.")
    flag.BoolVar(&passThrough, "t", false, "Pass serial input to STDOUT (shorthand).")

    flag.BoolVar(&logging, "log", false, "Log HTTP requests to STDOUT")
    flag.BoolVar(&logging, "l", false, "Log HTTP requests to STDOUT (shorthand).")

    flag.BoolVar(&devMode, "dev", false, "Dev mode")
    flag.BoolVar(&devMode, "d", false, "Dev mode (shorthand).")

    flag.IntVar(&maxLogSize, "num", 180, "Number of previous temperatures to keep in memory.")
    flag.IntVar(&maxLogSize, "n", 180, "Number of previous temperatures to keep in memory (shorthand).")

    flag.UintVar(&baudRate, "baud", 115200, "Serial port baud rate.")
    flag.UintVar(&baudRate, "b", 115200, "Serial port baud rate.")

    flag.StringVar(&serialPort, "serial", "/dev/ttyATH0", "Serial port device.")
    flag.StringVar(&serialPort, "s", "/dev/ttyATH0", "Serial port device.")

    // Dev starting values
    lastDevGrouphead = 100.0
    lastDevBoiler = 180.0

    // Set up hub
    h.Connections = make(map[*socket]bool)
    h.Pipe = make(chan string, 1)
}

开发者ID:gregose,项目名称:PIDuino,代码行数:30,代码来源:PIDuino-ui.go

示例4: init

func init() {
    var secret string
    flag.StringVar(&secret, "secret", "", "The passphrase used to decrypt target server address")
    flag.StringVar(&cfgGatewayAddr, "addr", cfgGatewayAddr, "Network address for gateway")
    flag.StringVar(&cfgPprofAddr, "pprof", cfgPprofAddr, "Network address for net/http/pprof")
    flag.BoolVar(&cfgReusePort, "reuse", cfgReusePort, "Enable reuse port feature")
    flag.UintVar(&cfgDialRetry, "retry", cfgDialRetry, "Retry times when dial to target server timeout")
    flag.UintVar(&cfgDialTimeout, "timeout", cfgDialTimeout, "Timeout seconds when dial to targer server")
    flag.UintVar(&cfgBufferSize, "buffer", cfgBufferSize, "Buffer size for io.CopyBuffer()")
    flag.Parse()

    cfgSecret = []byte(secret)

    cfgDialTimeout = uint(time.Second) * cfgDialTimeout

    handshakeBufPool.New = func() interface{} {
        buf := make([]byte, 64)
        return &buf
    }

    copyBufPool.New = func() interface{} {
        buf := make([]byte, cfgBufferSize)
        return &buf
    }
}

开发者ID:uin57,项目名称:gateway,代码行数:25,代码来源:main.go

示例5: init

func init() {
    const (
        defaultPort = 8080
        usagePort   = "port to connect to"

        usageDIR = "dir for HDG configuration files"

        usageInit       = "First time initialisation"
        defaultPassword = ""

        defaultMaxUploadSize = 100
        usageMaxUploadSize   = "Maximum upload size in MB."
    )

    defaultDIR := xdgbase.GetConfigHome() + "/hgd"

    flag.UintVar(&settings.port, "port", defaultPort, usagePort)
    flag.UintVar(&settings.port, "p", defaultPort, usagePort+" (shorthand)")

    flag.StringVar(&settings.dir, "dir", defaultDIR, usageDIR)
    flag.StringVar(&settings.dir, "d", defaultDIR, usageDIR+" (shorthand)")

    flag.StringVar(&initPassword, "init", defaultPassword, usageInit)

    flag.UintVar(&settings.maxUploadSize, "s", defaultMaxUploadSize, usageMaxUploadSize)

    log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime)
}

开发者ID:egelmex,项目名称:hgd2,代码行数:28,代码来源:main.go

最后编辑: kuteng  文档更新时间: 2021-08-23 19:14   作者:kuteng