Basic Syntax in Go

From the Go cheat sheet ยท Setup & Basics ยท verified Jul 2026

Basic Syntax

Go program structure and syntax

go
package main

import "fmt"

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

// Variables
var name string = "Go"
age := 25  // Short declaration
๐Ÿ“ Static typing with type inference
๐ŸŽฏ Simple, clean syntax without semicolons
๐Ÿ”ง := for short variable declarations
๐Ÿ“ฆ Package-based organization

More Go tasks

Back to the full Go cheat sheet