yesdoing
Frontend Developer
2020.04.24
yesdoing
Go(Golang) 은 2009년에 구글에서 개발한
컴파일 프로그래밍 언어로 다양한 목적을 가지고 개발되었습니다.
What is the Go?
Go는 다음과 같은 장점들을 가지고 있습니다.
What is the Go?
What is the Go?
Go는 등록된 Keyword의 수가 다른 언어보다 적습니다.
배우고 이해해야 할 키워드의 수가 적기 때문에 간결하고
이해하기 쉬운 코드를 작성하기 쉽습니다.
What is the Go?
Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
What is the Go?
Go 의 특징을 말할 때 동시성을 빼놓을 수 없습니다.
Go는 다른 언어에 비해 쉽게 동시성 코드를 작성 할 수 있으며
처음 언어를 설계할 때부터 개발팀이 동시성을 고려하여
언어의 설계와 GC를 설계하였습니다.
What is the Go?
What is the Go?
타입 시스템
고는 계층구조가 없는 유연한 타입 시스템을 제공합니다.
Go는 합성이라고 부르는 디자인 패턴과 비슷하게 메서드를
재 사용하기 위해 타입을 받습니다.
이로 인해 결합성을 떨어뜨리고 높은 응집도를 가진
모델링을 구현할 수 있습니다.
How to install
설치 방법은 크게 2가지로 나뉩니다.
How to install
1. 홈페이지를 통한 설치
How to install
1. 홈페이지를 통한 설치
홈페이지를 통한 설치 시 설치 프로그램이 자동으로 GOPATH를 잡아줍니다.
하지만 GOPATH 설정을 바꾸고 싶으시면 터미널의 bash 파일에서
PATH를 수정해 주시면 됩니다.
How to install
2. Homebrew를 이용한 설치
How to install
GOPATH에 만든 3가지 파일은 다음과 같은 역할을 가지고 있습니다.
Project Setting
Go V1.11 이전 까지는 GOPATH의 src 폴더 아래에서만
코드 작성이 가능했습니다.
하지만 Go V1.11 에서 Go modules 가 나오면서 GOPATH 외부에서 Go 소스코드 작성이 가능하게 되었습니다.
Project Setting
Go modules 를 사용하여 Go Project를
생성하는 방법은 다음과 같습니다.
modulepath를 작성하면 go.mod 파일이 생성되면서
go version과 build에 필요한 dependency 가 쓰여집니다.
Hello Go!
Go
Java
Variables
Variables Types
Go 의 Primitive Types
int8 은 int로 축약해서
사용 할 수 있지만
float type은 축약을 할 수 없다.
Array & Iteration
struct & method
By yesdoing