number23
number23

just for fun

my golang note

Just for me, for saving. -:)

大写第一个字母:public, package name: 小写

:=

uint8 => byte(0-255), int32 => rune

nil: interface, function, pinter, slice, map, chan

const: iota, true, false, nil

func append(s []T, vs ...T) []T

import: dot, alias, init

make: make(T args), slice, map,channel

if, for, switch: define var , switch: fallthrough

interface: func (a type) f => func (a *type) f

(value, type): t, ok := i.(T)

error is a interface, defer: LIFO

func panic(interface {})

func recover() interface {}


channel timeout, select , sync.Once

one-way: send: chan<-, receive: <-chan


没有隐式数值类型强制转换

没有构造或析构函数

没有运算符重载

没有形参默认值

没有继承

没有泛型

没有异常

没有宏

没有函数注解

没有线程局部存储

没有未初始化变量


go run -race main.go

go tool cover

go test -bench=.

go test -cpuprofile=cpu.out

go test -memprifile=men.out

go tool pprof -text cpu.out

go get -v -u github.com/...


GO111MODULE:

go mod init

go mod tidy

CC BY-NC-ND 2.0 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…

发布评论