go 4

[Concurrency-2] Chapter 3 channel 전까지

Go는 model of concurrency 로 fork-join model를 따른다. fork라는 단어는 parent와 concurrently 하게 동작하기 위해서 child branch를 split off 할 수 있음을 의미한다. join이라는 것은 미래의 한 시점에 parent로 다시 branch가 join된다는 것을 의미한다. sayHello := func { fmt.Println("hello") } go sayHello() //continue doing other things main function 의 나머지 부분들은 빠르게 실행될 것이고, sayHello 함수가 실행될지 안될지는 undetermined이다. join point를 만드는 것이 중요하다. 그래서 race condition일 뿐인..

Backend with Golang 2023.06.12

Go's Syntax

참고 자료 1. https://go.dev/blog/declaration-syntax 2. https://go.dev/tour/basics/12 3. https://go.dev/tour/moretypes/1 4. https://soyoja.com/263 : 비트 이동 연산자 Go 와 C syntax가 다른 이유에 대해서 C syntax는 declare할 때 그것이 앞으로 가지게 될 type을 명시하는 형태이다. int x; 와 같이 x는 int 일 것임을 declare하는 것이다. int *p; *p가 int라는 것. p가 int를 향한 pointer라는 것을 의미한다. int a[2]; a[2]가 int type을 가지기 때문에 a는 int의 array임을 의미한다. 함수의 경우에는 paren 바깥에서..

Backend with Golang 2023.04.27