Welcome & Hello World

🐹 Go Language Lesson 1 Beginner

Go (often called Golang) is a statically-typed, compiled programming language designed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. Known for its simplicity, lightning-fast compilation, and first-class concurrency features, it is the backend language of choice for cloud infrastructure (Docker, Kubernetes) and microservices.

1 Static Compilation & Execution Model

Unlike languages that require virtual machine layers (like Java's JVM) or interpreted runtimes (like Python), Go compiles directly into **a single, self-contained static binary** containing all standard libraries. This eliminates environment dependency issues on target servers and allows Go applications to start up instantly with minimal memory footprints.

2 Your First Go Program

Let's write a standard Hello World code template in Go. Write and compile this in the editor:

Go — Hello World ▶ Run Code
package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
    fmt.Print("Welcome to Our Go Compiler!")
}

Let's analyze the syntax components:

  • package main: Declares that this source file belongs to the `main` package, telling the Go compiler to generate an executable binary rather than a shared library.
  • import "fmt": Injects the standard formatting package, housing output utilities like `Println()`.
  • func main(): The mandatory entry point function for every executable Go program.
  • fmt.Println(): Prints text to the screen and appends a trailing newline.
3 Code Challenge
Challenge: Edit the code in the editor above. Use `fmt.Printf` with the type specifier (`${"%T"}`) to print the type of a string variable (e.g. `fmt.Printf("%T\n", "Golang")`). Run the code to verify.