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
Function: Initialization | argument | multiple returns | named return
-
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
-
-
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
- When is
defer
called?It was called according the consuming sequence of stack. That is to say, the first
defer
clause will be invoked as the last. defer
andpanic
which is run first?First
defer
, thenpanic
.- Difference between
new()
andmake()
?For
new
function, it returns pointer. It is used when initiate struct.Make
is mostly used when initiate slice, map and channel. - Can
append()
receive pointer as parameter?No.
- go run order,
- Can global variable declared with short declaration?
No.
- Difference between passing value and passing pointer as parameter of function?
When passing value, it will create a new copy. For pointer, it will pass the value itself.
str := "hello", str[1] = 'a'
Is the string gonna modified?No. Because the string is a constant.
- Can we assign nil to
string
?No. But we can assign nil to
*string
- If
map
andrange
is executed by sequence?No.
- If two slice object can be compared with
==
?No.
- Is there a difference between new() and “regular” allocation?
No. &Vector{} , new(Vector) is the same, one thing to note: new() is the only way to get a pointer to an unnamed integer or other basic type. You can write "p := new(int)" but you can't write "p := &int{0}".
- When is