Back to Blog

Introduction to Go (Golang Setup & First Program). - Go Tutorial for Beginners #1

Sandy LaneSandy Lane

Video: Introduction to Go (Golang Setup & First Program). - Go Tutorial for Beginners #1 by Taught by Celeste AI - AI Coding Coach

Watch full page →

Introduction to Go (Golang Setup & First Program)

Go, also known as Golang, is a modern, compiled programming language created by Google that emphasizes simplicity, fast compilation, and performance. In this introduction, you'll learn how to set up Go, write your first program, understand the essential structure of a Go application, and explore basic arithmetic operations.

Code

// hello.go
package main

import "fmt"

func main() {
  // Print welcome messages to the console
  fmt.Println("Welcome to Go Programming!")
  fmt.Println("Let us build something great!")
}

// calculator.go
package main

import "fmt"

func main() {
  // Basic arithmetic operations in Go
  fmt.Println("Addition:", 10 + 5)            // Outputs: 15
  fmt.Println("Division:", 10 / 3)            // Integer division, outputs: 3
  fmt.Println("Float division:", 10.0 / 3.0)  // Floating-point division, outputs: 3.3333333
}

Key Points

  • Every Go program starts with package main and a func main() as the entry point.
  • The fmt package is used to print output to the console with functions like Println.
  • go run compiles and runs Go programs quickly, while go build creates a standalone executable binary.
  • Go supports basic arithmetic operations; integer division truncates decimals, so use floats for precise decimal results.
  • Go compiles to a single binary with no dependencies, making it ideal for deployment and performance-critical applications.