gogrpc安装

Prerequisites Go version gRPC works with Go 1.5 or higher. $ go version For installation instructions, follow this guide: Getting Started - The Go Programming Language Install gRPC Use the following command to install gRPC. $ go get google.golang.org/grpc Install Protocol Buffers v3 Install the protoc compiler that is used to generate gRPC service code. The simplest way to do this is to download pre-compiled binaries for your platform(protoc-<version>-<platform>.

golangappend的并发问题

先看一段代码 ackage main import ( "fmt" "sync" ) func main() { var wg sync.WaitGroup s := make([]int, 0, 1000) for i := 0; i < 1000; i++ { v := i wg.Add(1) go func() { s = append(s, v) wg.Done() }() } wg.Wait() fmt.Printf("%v\n", len(s)) } 结果 第一次:928 第二次:945 第三次

设计模式(golang)

设计模式的六大原则 摘自 Java开发中的23种设计模式详解 1、开闭原则(Open Close Principle) 开闭原则就是说对扩展开放,对修改关闭。在