后端程序员之路 53、A Tour of Go-3
#method
- Methods
- Go does not have classes. However, you can define methods on types.
- func (f MyFloat) Abs() float64 {
- Interfaces
- type Abser interface { Abs() float64 }
- One of the most ubiquitous interfaces is Stringer defined by the fmt package.
- Go programs express error state with error values.
- The io package specifies the io.Reader interface, which represents the read end of a stream of data.
- Package image defines the Image interface
# concurrency
- Goroutines - go say("world")
- Channels
- Channels are a typed conduit through which you can send and receive values with the channel operator, <-.
- ch := make(chan int)
- ch <- v // Send v to channel ch.
- v := <-ch // Receive from ch, and assign value to v.
- Buffered Channels - ch := make(chan int, 100)
- Select
- The select statement lets a goroutine wait on multiple communication operations.
- The default case in a select is run if no other case is ready.
- sync.Mutex
- mux sync.Mutex
- c.mux.Lock()
- defer c.mux.Unlock()
A Tour of Go
https://tour.golang.org/list
后端程序员之路 53、A Tour of Go-3的更多相关文章
- 后端程序员之路 51、A Tour of Go-1
# A Tour of Go - go get golang.org/x/tour/gotour - https://tour.golang.org/ # welcome - ...
- 后端程序员之路 52、A Tour of Go-2
# flowcontrol - for - for i := 0; i < 10; i++ { - for ; sum < 1000; { ...
- 后端程序员之路 59、go uiprogress
gosuri/uiprogress: A go library to render progress bars in terminal applicationshttps://github.com/g ...
- 后端程序员之路 43、Redis list
Redis数据类型之LIST类型 - Web程序猿 - 博客频道 - CSDN.NEThttp://blog.csdn.net/thinkercode/article/details/46565051 ...
- 后端程序员之路 22、RESTful API
理解RESTful架构 - 阮一峰的网络日志http://www.ruanyifeng.com/blog/2011/09/restful.html RESTful API 设计指南 - 阮一峰的网络日 ...
- 后端程序员之路 16、信息熵 、决策树、ID3
信息论的熵 - guisu,程序人生. 逆水行舟,不进则退. - 博客频道 - CSDN.NEThttp://blog.csdn.net/hguisu/article/details/27305435 ...
- 后端程序员之路 7、Zookeeper
Zookeeper是hadoop的一个子项目,提供分布式应用程序协调服务. Apache ZooKeeper - Homehttps://zookeeper.apache.org/ zookeeper ...
- 后端程序员之路 4、一种monitor的做法
record_t包含_sum._count._time_stamp._max._min最基础的一条记录,可以用来记录最大值.最小值.计数.总和metric_t含有RECORD_NUM(6)份recor ...
- 后端程序员之路 58、go wlog
daviddengcn/go-colortext: Change the color of console text.https://github.com/daviddengcn/go-colorte ...
随机推荐
- poj 1113 wall(凸包裸题)(记住求线段距离的时候是点积,点积是cos)
Wall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 43274 Accepted: 14716 Descriptio ...
- poj3693 Maximum repetition substring (后缀数组+rmq)
Description The repetition number of a string is defined as the maximum number R such that the strin ...
- hdu 13394 Minimum Inversion Number 线段树
题意: 首先给你一个长度为n的序列v,你需要首先找出来逆序对(i<j && v[i]>v[j]) 然后把这个序列的最后一个元素放在第一个位置上,其他元素都向后移动一位. 一 ...
- Codeforces #637 div2 B. Nastya and Door
题意:给你一个数组a,定义:若a[i]>a[i]&&a[i]>a[i-1],则a[i]为峰值,求长度为k的区间内峰值最多能为多少,并输出这个区间的左端点(区间需要将峰的左边 ...
- CodeForces - 449B 最短路(迪杰斯特拉+堆优化)判断最短路路径数
题意: 给出n个点m条公路k条铁路. 接下来m行 u v w //u->v 距离w 然后k行 v w //1->v 距离w 如果修建了铁路并不影响两点的最短距离, ...
- Mysql主从架构
Mysql主从架构 1. 克隆虚拟机 克隆的虚拟机的网络适配,使得虚拟机可以进入局域网 vi /etc/sysconfig/network-scripts/ifcfg-eth0 删除 HWADDR所在 ...
- python = 赋值顺序 && C++ side effect
title: python = 赋值顺序 && C++ side effect date: 2020-03-17 15:00:00 categories: [python][c++] ...
- HDU 3949 XOR (线性基第k小)题解
题意: 给出\(n\)个数,求出子集异或第\(k\)小的值,不存在输出-1. 思路: 先用线性基存所有的子集,然后对线性基每一位进行消元,保证只有\(d[i]\)的\(i\)位存在1,那么这样变成了一 ...
- ubuntu+将主机编译的库链接到虚拟环境Python中
这里且以opencv为例: cd ~/.virtualenvs/YOUR_ENV/lib/python3.5/site-packages/ ln -s /usr/local/lib/python3.5 ...
- bash variables plus operator All In One
bash variables plus operator All In One Errors missing pass params #!/usr/bin/env bash # echo emoji ...