nugawiki

./categories/back-end

Go Hello World

업데이트 2026-07-21 조회수

GOPATH/src/hello/hello.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}
go build hello.go   # Linux/Mac: hello, Windows: hello.exe
./hello             # 또는 .\hello
  • go build: 지정 파일만 컴파일 → 현재 디렉터리
  • go install: 패키지 전체 → bin
  • 실행은 package mainmain()부터

./comments