golang 공부용 모음집(추후 정리)

최대 1 분 소요

Go Slices

https://blog.golang.org/slices-intro

init functions

https://golang.org/doc/effective_go#init

And finally means finally: init is called after all the variable declarations in the package have evaluated their initializers, and those are evaluated only after all the imported packages have been initialized.

Besides initializations that cannot be expressed as declarations, a common use of init functions is to verify or repair correctness of the program state before real execution begins.

blank identifier

https://golang.org/doc/effective_go#blank

If an assignment requires multiple values on the left side, but one of the values will not be used by the program, a blank identifier on the left-hand-side of the assignment avoids the need to create a dummy variable and makes it clear that the value is to be discarded.

map type concurrency

https://blog.golang.org/maps

Maps are not safe for concurrent use: it’s not defined what happens when you read and write to them simultaneously. If you need to read from and write to a map from concurrently executing goroutines, the accesses must be mediated by some kind of synchronization mechanism. One common way to protect maps is with sync.RWMutex.

golang memory model

https://golang.org/ref/mem

golang syntax

https://blog.golang.org/declaration-syntax

golang map implementation

https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics

Mongodb modeling with golang

https://www.mongodb.com/blog/post/quick-start-golang–mongodb–modeling-documents-with-go-data-structures