golang语言
文章平均质量分 81
haolifengwang
好读书,以读书提高自己的修行,达到人生的最终目标。
展开
-
golang 开发 环境搭建
1. 操作系统以及golang安装使用操作系统redhat7.2 x86_64为,将golang解压后拷贝到/usr/local/目录下,通常目录将是这个样子:/usr/local/go/bin在~/.bash_profile中添加export GOROOT=/usr/local/goexport PATH=$PATH:$GOROOT/bin2 gocode下载安装golang的安装目录中自带了g...原创 2018-03-09 17:53:39 · 883 阅读 · 0 评论 -
grpc node 与golang通信
一 、golang 设置1 安装protobufgo get github.com/google/protobufsudo apt-get install autoconf automakelibtool./autogen.sh./configuremakemake install2 安装插件protoc-gen-gogo get -ugithub.com/golang/proto...原创 2018-05-02 17:08:49 · 1141 阅读 · 0 评论 -
golang并发模式runner
1 runner/runner.gopackage runnerimport ( "errors" "os" "os/signal" "time")type Runner struct { interrupt chan os.Signal //接收信号的通道 complete chan error ...原创 2018-05-22 10:53:24 · 1466 阅读 · 0 评论 -
golang并发模式work
1 work.gopackage workimport ( "sync")type Worker interface { //定义接口,需实现Task()函数 Task()}type Pool struct { work chan Worker //通道,发送worker wg sync.WaitGroup }func New(maxGoroutines int) ...原创 2018-05-22 11:34:14 · 1838 阅读 · 0 评论 -
golang并发模式pool
1 pool.gopackage poolimport ( "errors" "log" "io" "sync")type Pool struct { m sync.Mutex resources chan io.Closer //传输io.Closer接口类型的数据 factory func() (io.Closer, error) //构造函数 closed bool}var Er...原创 2018-05-22 11:47:17 · 2119 阅读 · 1 评论