后端程序员之路 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 ...
随机推荐
- PAT(乙级)2020年春季考试
比赛链接:https://pintia.cn/market/item/1287964475579875328 7-1 对称日 题解 模拟,注意年月日不足位在前面补零. 代码 #include < ...
- hdu4352 XHXJ's LIS (数位dp)
Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then careful ...
- python对csv文件读写的两种方式 和 读写文件编码问题处理
''' 如果文件读取数据出错,可以考虑加一个encoding属性,取值可以是:utf-8,gbk,gb18030 或者加一个属性error,取值为ignore,例如 open(path, encodi ...
- Codeforces Round #579 (Div. 3) D2. Remove the Substring (hard version) (思维,贪心)
题意:给你一个模式串\(t\),现在要在主串\(s\)中删除多个子串,使得得到的\(s\)的子序列依然包含\(t\),问能删除的最长子串长度. 题解:首先,我们不难想到,我们可以选择\(s\)头部到最 ...
- hdu3033 I love sneakers!
Problem Description After months of hard working, Iserlohn finally wins awesome amount of scholarshi ...
- POJ 1742 Coins 【可行性背包】【非原创】
People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony ...
- UMD 模块 vs CJS 模块
UMD 模块 vs CJS 模块 使用方式 UMD, window 全局注册后,直接使用 <!DOCTYPE html> <html lang="zh-Hans" ...
- js double 精度损失 bugs
js double 精度损失 bugs const arr = [ 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 ]; // [ ...
- Array.fill & array padding
Array.fill & array padding arr.fill(value[, start[, end]]) https://developer.mozilla.org/en-US/d ...
- ORM All In One
ORM All In One ORM Object Relational Mapping https://en.wikipedia.org/wiki/Object-relational_mapping ...