后端程序员之路 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 ...
随机推荐
- 【论文研读】Sabir, Ekraam, et al. "Recurrent convolutional strategies for face manipulation detection in videos." Interfaces (GUI) 3.1 (2019).
#摘要 错误信息通过合成逼真的图像和视频进行传播这一严重问题,需要鲁棒的篡改检测方法来应对.尽管在检测静止图像上的面部篡改方面已付出了巨大的努力,但人们对于通过利用视频流中存在的时序信息,对视频中被篡 ...
- Codeforces Round #627 (Div. 3) C - Frog Jumps(逻辑)
题意: 有一个每个单元标明移动方向的长为n的序列,每次移动不能超过距离k,问能够从0移动到n+1的k的最小值. 思路: k=最长连续L序列长度+1. #include <bits/stdc++. ...
- Codeforces #637 div2 B. Nastya and Door
题意:给你一个数组a,定义:若a[i]>a[i]&&a[i]>a[i-1],则a[i]为峰值,求长度为k的区间内峰值最多能为多少,并输出这个区间的左端点(区间需要将峰的左边 ...
- 洛谷 P6225 [eJOI2019]异或橙子 (树状数组)
题意:有\(n\)个数,起始值均为\(0\),进行\(q\)次操作,每次输入三个数,如果第一个数为\(1\),则将第\(i\)个数修改为\(j\),如果为\(2\),则求区间\([l,r]\)内的所有 ...
- POJ-3984 迷宫问题 (BFS)
题意:有一个\(5\)X\(5\)的\(01\)图,输出从左上角走到右下角的最短路径. 题解:基础的bfs,这里困难的是如何输出这个最短路径,我们可以用一个结构体来存点和路径,我们每次向外去拓展的时候 ...
- 牛客编程巅峰赛S1第6场 - 黄金&钻石&王者 B.牛牛摆放花 (贪心)
题意;将一组数重新排序,使得相邻两个数之间的最大差值最小. 题解:贪心,现将所有数sort一下,然后正向遍历,将数分配到新数组的两端,然后再遍历一次维护一个最大值即可. 代码: class Solut ...
- git仓库更换远程地址
首先进入项目所在文件夹,右键git bash (1)查看当前的远程地址 git remote -v (2)删除当前的远程地址 git remote rm origin (3)添加远程地址 git re ...
- 在kubernetes集群里集成Apollo配置中心(3)之交付Apollo-portal至Kubernetes集群
1.执行apollo-portal数据库脚本 apollo-portal数据库脚本链接:https://raw.githubusercontent.com/ctripcorp/apollo/1.5.1 ...
- pyhook的简单使用
实验内容: 通过python编程调用windows的api,编写键盘和鼠标监控的hook,将相关信息保存记录到txt文档中. 实验步骤: 1.Hook技术,pyHook3和pywin32简介 1.1 ...
- (转载)RTMP协议中的AMF数据 http://blog.csdn.net/yeyumin89/article/details/7932585
为梦飞翔 (转载)RTMP协议中的AMF数据 http://blog.csdn.net/yeyumin89/article/details/7932585 这里有一个连接,amf0和amf3的库, ...