golang 真棒golang去

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了golang 真棒golang去相关的知识,希望对你有一定的参考价值。

## Lib

+ https://github.com/mikefarah/yaml/
+ https://github.com/Masterminds/vert

## Best pratrices

+ https://talks.golang.org/2013/bestpractices.slide#11
+ https://github.com/codeship/go-best-practices

## Design Patern

http://blog.ralch.com/tutorial/design-patterns/golang-builder/

## read, write config

+ https://github.com/spf13/viper

## decode
+ https://github.com/mitchellh/mapstructure

golang 去并发测试(我学习去)

package main

import (
    "fmt"
    "time"
)

func main() {
    fmt.Println("Concurrency test")

    concurrency := 5
    workers := make(chan bool, concurrency)

    // Ensure each worker is set to true (ready)
    for i := 0; i < cap(workers); i++ {
        select {
            default:
                workers <- true
        }
    }

    // i is purely for output reasons
    for i := 0; ; i++ {
        select {
            case <-workers:
                output := make(chan string)

                go func(w chan bool) {
                    defer func() {
                        w <- true
                    }()

                    output <- fmt.Sprintf("request %d", i)
                    time.Sleep(1000 * time.Millisecond)
                }(workers)

                fmt.Println(<-output)
        }
    }
}

以上是关于golang 真棒golang去的主要内容,如果未能解决你的问题,请参考以下文章

golang [去阻塞频道]与Go#golang,#go,#go channels,#go synchronization,#goroutines,#waitgroups中的频道同步和阻止,

text 去golang.org/x

markdown 去(Golang)GOOS和GOARCH

markdown 去(Golang)GOOS和GOARCH

markdown 去(Golang)GOOS和GOARCH

sh 去Jenkins CI脚本 - golang