Skip to content

eoeung/study-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 About This Repository

기초 Go 스터디


🔨 Stacks

Language



🔍 How to use

  1. Go 설치
    # go 버전 확인
    $ go version
    
    # go 환경변수 확인
    $ go env
    • 기본적으로 아래 경로에 설치됨 (Windows)

      C:\Program Files\Go

    • GOPATH와 GOROOT가 있는데, 자세히 살펴봐야함
  2. Git 설치

| Hello World 출력하는 간단한 예제

  1. workspace 폴더 생성
  2. hello.go 파일 생성
  3. 아래 코드를 작성
    package main
    
    import "fmt"
    
    func main() {
        fmt.Println("Hello World")
    }

    ※ VSCode로 진행할 때는, Go Extension을 설치해야함
    설치 에러는 무시해도 됨

  4. Terminal에서 아래와 같이 명령어 작성
    # 1) hello.go를 실행 → Hello World 출력
    $ go run hello.go
    
    # 2) hello.exe 생성 (windows)
    $ go build
    # 이 명령어를 실행하면 아래와 같은 에러 발생
    # go: go.mod file not found in current directory or any parent directory; see 'go help modules'
    
    # 3) go mod init 프로젝트명
    $ go mod init study-go/hello
    
    # 4) 생성된 hello.exe 파일 실행
    $ hello.exe

About

[스터디] Go에 대해서 공부한 내용을 기록한 레포지토리입니다.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published