본문 바로가기

go3

Go google style guides - decisions 이전에 했던 style guide보다는 좀 더 서술적이고 예시가 많은 문서이다. 참고 문서: https://google.github.io/styleguide/go/decisions Naming Underscore를 피하자. 다음 케이스만 예외로 둔다. *_test.go 안의 Test, Benchmark and Example function OS와 직접 통신하는 system library util, utility, common, helper와 같은 무의미한 패키지 이름을 피하자. Receiver 이름은 짧고, 축약어를 많이 사용하라. func (tray Tray) → func (t Tray) func (info *ResearchInfo) → func (ri *ResearchInfo) 상수 이름은 다른 이름.. 2023. 12. 9.
goroutine 파헤치기 Go 언어에서는 내부적으로 고루틴이라는 경량 쓰레드를 사용해서 Concurrency를 구현한다. 하지만 그동안은 정확히 쓰레드와 어떤 차이가 있고 어떻게 고루틴이 동작하는지 정확히 알지 못한 채 사용하기만 해서 이번 기회에 이를 정리해두고자 한다. 참고 문서 https://blog.nindalf.com/posts/how-goroutines-work/ https://syntaxsugar.tistory.com/entry/GoGolang-Scheduler https://ssup2.github.io/theory_analysis/Golang_Goroutine_Scheduling/ https://www.ardanlabs.com/blog/2018/08/scheduling-in-go-part2.html Goroutin.. 2023. 9. 23.
[후기] entgo 두달 사용 후기 golang으로 db에 접근하기 위해서 entgo를 사용해 보았다. 사실 약 두 달 정도 사용해본 터라 query optimization까지는 가지 못했고, 기본적으로 제공해주는 함수를 이용해서 쿼리, insert 등의 작업을 진행했다. 설치 https://entgo.io/docs/getting-started Quick Introduction | ent ent is a simple, yet powerful entity framework for Go, that makes it easy to build entgo.io 설치의 경우에는 간단하게 go install entgo.io/ent/cmd/ent@latest 와 같이 할 수 있다. 구조 go generate ./ent 를 통해 현재 schema 내의 파일.. 2022. 7. 23.