본문 바로가기

개발일기/go

[go]go lang 시작하기

go lang 설치

 

1. 설치하기

 

운영체제에 따라 프로그램 설치

https://golang.org/dl/

 

Downloads - The Go Programming Language

Downloads After downloading a binary release suitable for your system, please follow the installation instructions. If you are building from source, follow the source installation instructions. See the release history for more information about Go releases

golang.org

 

운영체제 따라 설치완

 

2. 환경변수 설정

 

윈도우 시스템 환경변수 -> 사용자 변수

 

시스템 환경변수 편집
환경변수

 

여기 있는 GOPATH가 작업을 할 장소. 여기서 작업하려고 따로 변경하지 않았다

 

 

3. hello, world! 프린트하기

 

 

하위 디렉토리에 들어가 3개의 폴더를 각각 만든다

 

 

 

src 폴더 내에 .go 소스코드를 작성한다.

 

 

package main

import "fmt"

func main(){
	fmt.Println("Hello, World!")
}

 

 

cmd 창에서 실행

 

 

hello world는 항상 짜릿하다