Skip to content
Novus Examples
go111 B

Go — Hello World

The classic hello-world in Go — package main, an import, and fmt.Println, tab-indented like gofmt — for testing highlighters, the Go compiler, and parsers.

Preview — first 9 linesgo
// The classic first program, in Go.
package main

import "fmt"

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

Specifications

Language
Go
Kind
hello-world
Lines
8
Encoding
UTF-8
Line Endings
LF

What is a .go file?

Go (.go) is a plain-text source file for the Go programming language — a statically typed, compiled language from Google designed for simplicity and concurrency. It features goroutines and channels, a fast compiler, garbage collection, structs with methods, and interfaces, with a strict standard formatting.

How to use this file

Use an example .go file to test syntax highlighters, the Go compiler and vet, gofmt, linters, and parser or language-detection tooling.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.