Skip to content

golang #28

@mangreen

Description

@mangreen

golang面試題整理

slice & channel 的底层原理和注意事项

  1. unbuffered vs buffered channel
  2. make 與 new 的差別
  3. rune vs byte
  4. type assertion
  5. 使用 slice of pointers 或 slice of structs

常規性Golang面試題解析

https://www.jishuwen.com/d/2Oti/zh-tw

Go 實現常用設計模式

https://learnku.com/users/42861/articles?page=2

Go 易錯面試題彙總 (code)

https://learnku.com/articles/35063

type assertion

event, err := New(0)
if err != nil {
    t.Error(err)
}
_, ok := event.(Like)
if !ok {
    t.Error("Assertion error")
}

sync

https://juejin.cn/post/6844904175944351752

  1. sync.Mutex
  2. sync.RWMutex
  3. sync.WaitGroup
  4. sync.Once
  5. sync.Map
  6. sync.Pool
  7. sync.Cond

匿名函數語閉包

https://openhome.cc/Gossip/Go/Closure.html

var foo = func() func() {
    var i int     
    return func() {  
        i++         
        fmt.Println(i)     
    } 
}() 
foo() // 1
foo() // 2
foo() // 3

Go semaphore

https://zhuanlan.zhihu.com/p/389718532

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions