后端程序员之路 51、A Tour of Go-1
# A Tour of Go
- go get golang.org/x/tour/gotour
- https://tour.golang.org/
# welcome
- fmt.Println("The time is", time.Now())
# basic
- Packages && Imports
- package main
- import (\n "fmt"\n "math"\n)
- fmt.Println("My favorite number is", rand.Intn(10))
- fmt.Println(math.Pi)
- Functions
- func add(x int, y int) int {
- func add(x, y int) int {
- Multiple results - func swap(x, y string) (string, string) {
- Named return values - func split(sum int) (x, y int) {
- Variables
- var c, python, java bool
- var c, python, java = true, false, "no!"
- Short variable declarations - k := 3
- bool、string、int8 uint16 uintptr、byte(uint8)、rune(int32)、float32 float64、complex64 complex128
- Zero values
- Variables declared without an explicit initial value are given their zero value.
- 0 for numeric types
- false for the boolean type
- "" (the empty string) for strings
- Type conversions
- i := 42
- f := float64(i)
- u := uint(f)
- Constants
- const World = "世界"
- const ( ... )
后端程序员之路 51、A Tour of Go-1的更多相关文章
- 后端程序员之路 53、A Tour of Go-3
#method - Methods - Go does not have classes. However, you can define methods on types. ...
- 后端程序员之路 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 ...
随机推荐
- 【bzoj 2597】[Wc2007]剪刀石头布(图论--网络流 最小费用最大流)
题目:在一些一对一游戏的比赛(如下棋.乒乓球和羽毛球的单打)中,我们经常会遇到A胜过B,B胜过C而C又胜过A的有趣情况,不妨形象的称之为剪刀石头布情况.有的时候,无聊的人们会津津乐道于统计有多少这样的 ...
- B. Queue
During the lunch break all n Berland State University students lined up in the food court. However, ...
- Educational Codeforces Round 95 (Rated for Div. 2) B. Negative Prefixes (贪心,构造)
题意:给你一串长度为\(n\)的序列,有的位置被锁上了,你可以对没锁的位置上的元素任意排序,使得最后一个\(\le0\)的前缀和的位置最小,求重新排序后的序列. 题解:贪心,将所有能动的位置从大到小排 ...
- 使用docker时报错“net/http: TLS handshake timeout”
问题原因 :该命令默认从docker远端镜像仓库中拉取镜像,但由于远端仓库的服务器是在国外,我们国内有的用户很可能都访问不到 解决:使用国内镜像仓库 docker pull registry.dock ...
- 被收费绘图工具 PUA 了怎么办?来看看这个老实工具吧
本文非常适合 Electron 入门选手,墙裂推荐! 本文作者:HelloGitHub-蔡文心 大家好!这里是 HelloGitHub 推出的<讲解开源项目>系列,今天给大家带来的一款基于 ...
- 关于优先队列的总结II
优先队列这个数据结构还是很有用的,可以帮我们解决很多棘手的排序的问题,所以再来细细看一下, priority_queue<Type, Container, Functional> Type ...
- setTimeout 实现原理, 机制
setTimeout 实现原理, 机制 JS 执行机制说起 浏览器(或者说 JS 引擎)执行 JS 的机制是基于事件循环. 由于 JS 是单线程,所以同一时间只能执行一个任务,其他任务就得排队,后续任 ...
- auto open Chrome DevTools in the command line
auto open Chrome DevTools in the command line --auto-open-devtools-for-tabs # macOS $ /Applications/ ...
- HTML5 & canvas fingerprinting
HTML5 & canvas fingerprinting demo https://codepen.io/xgqfrms/full/BaoMWMp window.addEventListen ...
- 利用Metasploit 打入ThinkPHP内网...
出品|MS08067实验室(www.ms08067.com) 本文作者:dch(Ms08067实验室 SRSP TEAM小组成员) 一.利用Metasploit进行攻击的流程图 Metasploi ...