Field note
Getting Started With Go
Go (or Golang) is a modern programming language created by Google, designed to be simple, fast, and reliable. If you want to try it out, you don’t need much — just a machine (Windows or Linux) and a bit of curiosity.
🛠 Installing Go On Windows
- Download Go from the official site.
- Run the installer and follow the defaults.
- Open PowerShell or Command Prompt and check:
go versionCreate a file called hello.go:
package main
import "fmt"
func main() {
fmt.Println("Hello, Go World!")
}Run it with:
go run hello.goOr I can build a binary
go build hello.go
.\hello.exe
Hello, Go World!Let’s build a simple DIY tool: a command that greets you with your name.
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: greet <name>")
return
}
name := os.Args[1]
fmt.Printf("Hello, %s! Welcome to Go.\n", name)
}As result we can pass argument to our tool
PS C:\Users\user\Desktop\GoLearn> go build .\tool.go
PS C:\Users\user\Desktop\GoLearn> .\tool.exe
Usage: greet <name>
PS C:\Users\user\Desktop\GoLearn> .\tool.exe Denis
Hello, Denis! Welcome to Go.
PS C:\Users\user\Desktop\GoLearn> 