공부
-
Go interface 구현 시 pointer receiver 오류공부/GO 2023. 7. 11. 05:46
https://go-tour-ko.appspot.com/methods/25 Go를 향한 여행 go-tour-ko.appspot.com Tour of Go 중 interface에 대한 실습(Method와 Interface #25)을 진행하면서 발생했던 오류에 대해서 다룬다. image.Image interface의 구현을 다루는 다음 코드는 오류를 일으킨다. package main import "image/color" import "image" import "golang.org/x/tour/pic" type Image struct{ ImageBounds image.Rectangle Color color.Color } func (image *Image) ColorModel() color.Model { ret..
-
Go 언어의 세미콜론 ;공부/GO 2023. 7. 4. 05:49
Go언어는 세미콜론을 생략하여 사용한다. 정확하게 말하자면 세미콜론을 생략할 수 있다. https://go.dev/doc/effective_go Effective Go - The Go Programming Language Documentation Effective Go Effective Go Introduction Go is a new language. Although it borrows ideas from existing languages, it has unusual properties that make effective Go programs different in character from programs written in its relatives. A straigh go.dev 위 글에서 매우 잘..
-
Go tutorial - Hello World!공부/GO 2023. 7. 4. 05:08
Go를 처음 배운다. 프로그래밍 언어를 처음 배울 때에는 관례 상 Hello World를 찍어준다. 이는 마치 데니스 리치가 남겨놓은 유산으로 아마 100년 뒤에도 처음 언어를 배우면 Hello World부터 찍지 않을까 싶다. 처음 배우는 언어로 go를 선택한 사람도 있을 것 같으니(아마 없겠지만) 차근차근 설명하는 방식으로 하나씩 살펴보도록 하겠다. 공식문서: https://go.dev/doc/tutorial/getting-started Tutorial: Get started with Go - The Go Programming Language Documentation Tutorials Tutorial: Get started with Go Tutorial: Get started with Go In th..
-
Vim 설치하기 (Windows)공부/GO 2023. 7. 4. 04:43
Go언어를 배우기로 했다. 그래서 vim을 설치하기로 했다. 둘이 무슨 상관일까? 그냥 그런 기분이 들었다. go는 vim과 잘 맞는다. 잘 생각해보자. go를 사용하는 것은 시스템 프로그래밍과 밀접한 관계가 있다. 이것은 유닉스 내지는 리눅스 위에서 돌려야 제맛이다. 터미널 환경에서도 잘 작동하는 에디터, 그리고 잘 쓸 때 멋있는 에디터, 그것은 vim이다. 무엇보다 golang과 vim, 해피해킹이 함께 하는 개발자는 뽀대가 난다(힙스터 느낌 물씬 나는). 사실 vs code를 더 좋아하고 더 잘 쓰기는 한다. 그래도 go를 배울 겸 vim도 배워야 나중에 리눅스에서 코드를 작성할 일이 생길 때 아주 유용할 것이다. 그래서 vim을 에디터로 선택하였다. 사실 이성적 판단이라기 보다는 직감에 가까울 것..