Thuta Learning
ရှာဖွေရန်
BasicProgrammingbeginner

Get Started (Setup)

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

Go code ကို local computer မှာ run ဖို့ Go toolchain လိုပါတယ်။ Setup ပြီးသွားရင် go run နဲ့ တိုက်ရိုက် run နိုင်ပြီး go build နဲ့ executable file ထုတ်နိုင်ပါတယ်။

go
# Check Go installation
 go version

# Run a Go file directly
 go run hello.go

# Build an executable file
 go build hello.go

go version က Go install အောင်မြင်မအောင် စစ်တာပါ။ go run hello.go က compile + run ကို တစ်ခါတည်းလုပ်ပေးပြီး go build hello.go က နောက်မှ run လို့ရမယ့် executable binary ထုတ်ပေးပါတယ်။

You should see
go version go1.xx.x ... Hello, Go!

Info

Project ကြီးလာရင် go mod init project-name နဲ့ module စတင်ထားတာက dependency management အတွက်အရေးကြီးပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Command Prompt/Terminal ကို file ရှိတဲ့ folder ထဲမှာမဖွင့်ဘဲ go run hello.go လုပ်ရင် file not found ဖြစ်နိုင်ပါတယ်။
Get Started (Setup) | Thuta Learning