This repo contains my notes on work with Go and computer systems
-
Language Specification
- Syntax
- Variables: Zero value concept | Initialization | Const
- Constant: Initialization | iota
- Conversions: Conversion
- Struct: Declare_Initialize | Name And Anonymous type Field | Field Function| Iterate Field Name And Value | Selector and Promoted | Method Set
- Struct Tags: Wiki | Code | Tag-Doc
- Pointer:
- Function: Initialization | argument | multiple returns | named return
- Build-in types: Built-in types
- statement: statement | if else | for | switch | select | go
- Data Structures
- Enum: Enum
- Array: CPU Cache | TLB | Initialization | Iteration | Type array | Contiguous memory allocation
- Slice: Initialization | Length vs Capacity | Reference Type | Appending | Slice of Slice | Map | Reduce | Filter | Include | All|Any
- Map: Initialization | Iteration | Deleting | Finding | Restriction
- Channel: Declare | Iteration | Exit | send statements |receive operations
- Decoupling
- Method:
- Interface:
- Embedding:
- Exporting:
- Dependency management Go Modules
- Error Handling
- Context
- Syntax
-
Concurrency LearnConcurrency
-
Diagnostics Profiling
- Diagnostics Diagnostics
- Profiling code
- Stack Trace: Review
- GoLand Debug: GoLand Debug | blog
-
Testing
- Testing:
- Fuzzing
-
Design Pattern Design Patterns | javatpoint
- SOLID: SOLID
- Creational
- Simple Factory: wiki | code | best practices
- *Abstract factory: wiki | code | best practices
- *Builder: wiki | code1 | code2 | best practices orm query build | best practices es query build
- Factory method: wiki | code | best practices
- *Object Pool Pattern: wiki | code | best practices bilibili redis pool
- *Prototype: wiki | code | best practices
- *Singleton: wiki | code | best practices
- Structual
- Adapter: wiki | code | best practices
- *Bridge: wiki | code | best practices
- Composite: wiki | code | best practices
- *Decorator: wiki | code | best practices
- Facade: wiki | code | best practices
- Flyweight: todowiki | code | best practices
- Proxy (network proxy): wiki | code | best practices
- Behavioral
- *Chain of responsibility: wiki | code | best practices
- Command: todo wiki | code | best practices
- *Interpreter: todowiki | code | best practices
- *Iterator: wiki | code | best practices
- Mediator: todowiki | code | best practices
- Memento: todowiki | code | best practices
- Observer: todowiki | code | best practices
- State: todowiki | code | best practices
- *Strategy: wiki | code | best practices
- Template method : todowiki | code | best practices
- Visitor: todowiki | code | best practices
- Composition:
Guideline
- Conversion:
- Data Structures
- Graph algorithms
- Searching:
- shortest path:
- Sorting:
- Maths algorithms
- Binary GCD algorithm | (wiki)
- Closest pairs | (wiki)
- FastPower | (wiki)
- Fibonacci | (wiki)
- Fisher-Yates Shuffle-yates | (wiki)
- Erastothenes Sieve | (wiki)
- Extented GCD algorithm | (wiki)
- Karatsuba's Multiplication | (wiki)
- Newton's Squarenewton-sqrt | (wiki)
- Permutations Count
- Strassen's matrixstrassen | (wiki)
- Sorting algorithms
- Searching algorithms
-
Crypto
-
databases
-
Awesome Go
-
Docs
-
Interview
- defer的顺序,先进后出, 即压栈的顺序
- defer与panic的运行,先defer, 后panic
- range, key, value, 注意key , value地址都是固定的, value才变
- new(), make()区别, new返回pointer, 一般struct, make 返回type, 一般make slice, map, channel
- append(), 能传入pointer吗, 不能
- go run order,
- 全局变量能用short declaration吗, 不能
- 传value和传pointer的区别是? 传value创建副本, 传pointer就是传本身
- str := "hello", str[1] = 'a' 能修改吗, 不能, 因为"hello"是常量
- ...int, 可变函数
- x, y := f(), 单赋值时, 不可以赋值给已经赋值的, 多赋值时, 可赋值给已经赋值的
- string 类型能赋值为nil吗, 不能
- slice, slice时共享底层内存 ,
- if else, 块作用域,是整个if else
- map range 是无序的吗? 是
- iota, 常量计数, iota 在 const 关键字出现时将被重置为0,const中每新增一行常量声明将使 iota 计数一次
- map[string]*Math{"foo": &Math{2, 3}}, value类型是pointer才可以m["foo"].x
- slice能==比较吗?不能
- range slice, 循环次数在循环开始前就已经确定,循环内改变切片的长度,不影响循环次数
- 给nil channel发送or接收数据, 会永久阻塞
- 给close channel发送数据, 会panic
- 给close channel接收数据, 如果无数据则返回0
- panic, nil解析, index out of range, panic()
- 有方向的 channel 不可以被关闭
- 指针不支持索引
- Go 语言中,大括号不能放在单独的一行, 除非是code block